Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio Layout Preview disappeared

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

enter image description here

Thanks for your help!

Greetings Michael

like image 326
Michael Avatar asked Mar 13 '26 05:03

Michael


1 Answers

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>
like image 86
iBobb Avatar answered Mar 14 '26 21:03

iBobb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!