【问题标题】:android preview not work for layout file using merge with tools:parentTagandroid预览不适用于使用工具合并的布局文件:parentTag
【发布时间】:2019-02-04 21:16:07
【问题描述】:

根据this discussion,android xml布局文件可以使用工具:parentTag来预览布局使用标签。 我尝试了工具:parentTag,预览为空。 如果我删除 tools:parentTag,预览可以工作,所以我确定是tools:parentTag 使Preview 不能工作。

这是我的布局代码:

<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:orientation="vertical"
    tools:parentTag="android.widget.LinearLayout">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="hello" />
</merge>

enter image description here

有没有办法解决这个问题?

【问题讨论】:

标签: android android-layout


【解决方案1】:

你不见了

android:layout_width="match_parent"
android:layout_height="match_parent"

对于merge标签

【讨论】:

  • 谢谢,它有效!但是为什么我在输入“android:l”时没有收到代码建议。这是一个错误吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-06-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-09-07
  • 2012-06-19
相关资源
最近更新 更多