[英]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). 我的问题与此相似,但是Android Studio并没有告诉我有关渲染问题或编译器/构建错误的任何信息(我能够很好地构建)。
Here is what I am seeing(this is a new project) 这是我所看到的(这是一个新项目)
And the contents of content_main.xml 以及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. 我还尝试了不同版本的sdk(20,19),以查看布局预览是否正常工作,但我所得到的只是这个古怪的问题 ,我认为不会导致布局预览无法正常工作。
Does anyone know what my problem is here? 有人知道我的问题在这里吗? I didn't mess around with my initial Gradle files and remove any support library dependencies.
我没有弄乱我最初的Gradle文件,也没有删除任何支持库依赖项。 Another solution I had in mind was reinstalling Android Studio but that's last resort.
我想到的另一个解决方案是重新安装Android Studio,但这是不得已的方法。
Try putting your TextView element into an empty FrameLayout: 尝试将TextView元素放入一个空的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. 上面的代码应放在您的RelativeLayout中。 Hope it helps.
希望能帮助到你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.