【发布时间】:2021-02-21 01:47:14
【问题描述】:
在此示例中,不会显示文本,因为它被填充覆盖。
<TextView
android:padding="250px"
android:layout_width="500px"
android:layout_height="500px"
android:background="@color/yellow"
android:text="some text"
android:textColor="@color/red"/>
然而,在这个例子中,填充将被添加到尺寸上,因此会有更大的文本视图和可见文本。
<TextView
android:padding="250px"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/yellow"
android:text="some text"
android:textColor="@color/red"/>
有没有办法在纯 xml 中设置任意宽度和/或高度,并让视图大小包括填充,就像使用 html 一样?
【问题讨论】: