简体   繁体   中英

Why is my layout preview in Android Studio empty?

My issue is similar to this but Android Studio doesn't tell me anything about a rendering issue or compiler/build errors(I was able to build fine).

Here is what I am seeing(this is a new project) 在此处输入图片说明

And the contents of content_main.xml 在此处输入图片说明

After reading on different rendering issue threads, I I've tried rebuilding, cleaning, invalidate caches/restart and even starting a new project to see if the layout preview was working(Still empty)

I also played around with different sdk versions(20,19) to see if the layout preview was working but all I got was this quirky issue that I don't think would cause the layout preview to not work.

Does anyone know what my problem is here? I didn't mess around with my initial Gradle files and remove any support library dependencies. Another solution I had in mind was reinstalling Android Studio but that's last resort.

Just check your sdk valid version like example. 在此处输入图片说明

在此处输入图片说明

Try putting your TextView element into an empty FrameLayout:

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/my_groups" />

</FrameLayout>

This code above should be put inside your RelativeLayout. Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM