Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio shows wrong layout in layout preview (ActionBarOverlayLayout?!)

I have a nice FrameLayout as main container and some other views inside it's hierarchy.

But the preview shows a simple ActionBarOverlayLayout.

What is that? Why is it here?

I have Android Studio 3.0.0

I have tried: Restart Android Studio. Refresh the preview by resizing. Changed the preview device, changed the SDK of the preview, changed the blueprint\design options, pressed "force refresh layout" Button.

XML:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"

android:layout_height="wrap_content"
android:orientation="vertical"

android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="8dp">


<com.makeramen.roundedimageview.RoundedImageView
    android:layout_width="match_parent"
    android:layout_height="@dimen/walk_list_item_height"
    android:adjustViewBounds="false"
    android:cropToPadding="false"
    android:scaleType="centerCrop"
    app:layout_heightPercent="25%"
    app:layout_marginLeftPercent="0%"
    app:layout_marginTopPercent="0%"
    app:layout_widthPercent="100%"
    app:riv_corner_radius="@dimen/corner_radius"
    android:id="@+id/walk_iv" />


<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    android:background="@drawable/gradient"
    android:orientation="vertical"
    android:paddingBottom="16dp"
    android:paddingTop="16dp">

    <TextView
        android:id="@+id/walk_name_tv"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:gravity="center_vertical"
        android:padding="16dp"
        android:text="New Text"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="#fff" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:paddingLeft="16dp"
        android:paddingRight="16dp">

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:srcCompat="@drawable/ic_duration_icon" />

        <TextView
            android:id="@+id/duration_tv"
            android:layout_gravity="center"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="8dp"
            android:gravity="center|left"
            android:text="TextView"
            android:textColor="#fff" />


        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:srcCompat="@drawable/ic_marker"
            android:layout_marginLeft="16dp" />


        <TextView
            android:id="@+id/stops_tv"
            android:layout_gravity="center"

            android:layout_marginLeft="8dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="TextView"
            android:textColor="#fff" />

    </LinearLayout>
</LinearLayout>

</FrameLayout>

enter image description here

like image 347
Adam Varhegyi Avatar asked Nov 19 '22 02:11

Adam Varhegyi


1 Answers

That is because there is a broken build in your earlier build. It is coming from the intermediate files which is because the files are not proper in your xml files. There might be a broken link or a - in the drawables names.

Until you resolve this you cannot proceed to see the layout of your app in the layout-editor.

Moreover Android Studio will not show you any error in the error log or any other terminal.

Start from the styles/themes of the app, it might contain something which is missing from the gradle or resources of the project. Due to the support library still in the project it partially showcases it as missing control of XML files, but it will not let you load the xml editor visually for the project.

You have see that by yourself, start first from drawables and then move to values folder, if not check your gradle and then come back to Java files for the error.

like image 118
Shadab K Avatar answered Jan 31 '23 23:01

Shadab K