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

I have a nice FrameLayout as the main container and some other views inside its hierarchy.

But the preview shows a simple ActionBarOverlayLayout.

What is it? Why here?

I have Android Studio 3.0.0

I tried: Restart Android Studio. Refresh the preview by resizing. Changed the preview, changed the preview SDK, changed the design / design settings, clicked the “Force Update 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

+5
source share
3 answers

This is because your previous build has a broken build. This comes from intermediate files because the files do not match your xml files. Drawables may have a broken link or - .

Until you solve this, you cannot go to the layout of your application in the layout editor.

In addition, Android Studio will not show you any errors in the error log or any other terminal.

Start with the styles / themes of the application, it may contain something that is missing from the gradle or project resources. Due to the support library that is still present in the project, it partially demonstrates it as a lack of control over XML files, but it will not allow visualization of the xml editor for the project.

You yourself see this, first start with drawables, and then go to the values ​​folder, if you don't check your gradle, and then go back to the Java files for the error.

+1
source

I had to raise

buildToolsVersion up to 26.0.0

the previous one was listened to (25.0.2)

0
source

I had the same problem and in my case it was easier. I just got a warning recommending that you remove the link to BuildToolsVerison from the build.gradle file, so I just did it and then saved the whole file, Menu -> Run -> Make a project, and it worked fine.

Warning message

The solution

-1
source

Source: https://habr.com/ru/post/1273919/


All Articles