Reputation: 41
For my main_activity
, the layout preview disappeared after i was debugging.
I have 2 other layouts
in this Project, in which i can perfectly see the layout in the preview.
Also the component tree says: nothing to show
There is no rendering error showing up, below is xml
Thanks for your help!
Greetings Michael
Upvotes: 4
Views: 6086
Reputation: 1420
I have found the solution. In fact there is a bug in android studio. In my case the problem is that when I enable the tabStripEnabled
from "Properties" window, the component tree shows "Nothing to show" and when I disable it, everything goes well again.
So I solved this problem by coding programmatically :
tabHost.getTabWidget().setStripEnabled(true);
So I think you should to examine everything one by one in order to find the solution. I hope this could be helpful.
Upvotes: 0
Reputation: 21
You may have seen that you cannot see anything in "component tree" and have -nothing to show- in the "properties" section and also there is "android..ComponentLayout" showing in the preview built of the emulator.
I myself had tried different methods, but found the most convenient method to just remove the 3 lines of the code in the Main_Activity.xml file or you can just paste the following code or compare it with this one :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
>
Upvotes: 1
Reputation: 1
I have encountered this problem, but I am by modifying the configuration in the build.gragle file to solve this problem:
Upvotes: -3
Reputation: 1160
Have you tried Rebuilding the project, re-opening Android Studio, Invalidate Caches? That is if you are sure you did nothing and it just disappeared.
If that doesn't work, you could try saving the XML code in a txt file, deleting the xml layout, creating an empty one and pasting back the code.
Update:
What if you surround your LinearLayout with a ScrollView and then move the app:layout_behavior="@string/appbar_scrolling_view_behavior"
to the ScrollView instead. I think everything should work fine then.
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
your ImageView and TextViews here
</LinearLayout>
</ScrollView>
Upvotes: 3