android - “索引:0,大小:0 查看绘制错误”Android Studio 设计选项卡错误
问题描述
我最近将我的 AS 更新到 4.0 版本。之后,我在布局中放置了一个 EditText 和一个 TextView,如下所示:
<LinearLayout 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="match_parent"
android:orientation="vertical">
<TextView
android:text="EditText should be below me!"
android:textSize="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="I'm a hint"/>
</LinearLayout>
在屏幕截图的底部,您可以看到错误。谷歌搜索对我没有帮助,我发现的所有内容都是Design in Android studio error Index:0 size:0.... 查看 draw failed问题,没有答案。
我已经做了什么
我使缓存无效并重新启动了我的 AS,但它没有帮助。此外,我已将应用程序的主题从
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
至
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
没有影响。但是,一旦我设法将其更改为按钮元素样式之类的东西并且它起作用了,即使它不是我正在寻找的解决方案。如果我明确地将 EditText 的样式更改为类似
@style/Widget.AppCompat.Button.ButtonBar.AlertDialog
或者
@style/Widget.AppCompat.Button.Borderless
我可以看到编辑文本...
我会很感激你给我的任何帮助,伙计们。提前致谢!
更新:
可以通过在 AS 的设置中打开“使用新的布局渲染引擎”来解决这个问题。
无论如何,我希望我们能够找到并修复它,伙计们。感谢您的关注!
解决方案
推荐阅读
- c++ - 在 C++20 中,如果宏是#undef'd,然后又是#define'd,它是否被认为是“活动的”?
- python - 使用 df.join() 时获取指示符列
- android - com.airbnb.epoxy.IllegalEpoxyUsage:在添加模型之前,您必须在模型上设置一个 id
- docker - 从 GCP AI Platform 上运行的 docker 容器内部触发 POST 请求
- scala - Apache Spark 中的异常处理
- codeigniter - 在我的 codeigniter 视图页面上显示来自同一数据库表但具有不同类别的数据(使用相同的模型和控制器)
- version-control - 如何在 Visual SourceSafe 的历史视图中查看注释?
- flutter - 如何使用 Flutter 测试 GridView 小部件的所有元素是否导航到新屏幕?
- django - 带有假主机头的 Django 服务器端请求伪造
- oracle - 如何对运行数据导入(impdp)的oracle docker容器进行健康检查