android - 在 android studio 中使用 View 时出现渲染问题

标签 android android-studio

我是android studio的新手。当我在 android studio 中使用 new 时,我在预览中遇到渲染问题。

没有 View :

enter image description here

但是当我使用 View 时出现渲染问题:

enter image description here

我很困惑为什么会这样。请帮助我。

最佳答案

在 xml 中使用 View 而不是 view :

<View 
 android:layout_width="fill_parent"
 android:layout_height="fill_parent" />

对于 View 的高度和宽度也使用 match_parent 而不是 fill_parent 因为 fill_parent 常量从 API 级别 8 开始被弃用并被替换为match_parent

有关更多信息,请参阅此帖子:

What is the difference between match_parent and fill_parent?

关于android - 在 android studio 中使用 View 时出现渲染问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27863519/

相关文章:

android - 在 Android Studio 中为 Android 构建 Chromium 时出错

android - 新行写入文件

android - 在 Android Studio 中添加(外部)本地库项目作为依赖项

android - 无法在适配器内使用 finish()

android - 如何使用从后台线程加载的 RealmResult 并在 Android 主线程中使用它

android - 从android studio打开项目文件夹?

android - 结束 XML 标签的正确方法

android - 在 Android 上为 HLS 流呈现隐藏式字幕

java - 升级到Gradle 7后如何将android库发布到本地目录

android - EditText 自定义光标错误地绘制在第一行