Mr.*_*Mr. 7 android android-layout
如何include
在Android中的标签上设置背景颜色?这不起作用:
<include
android:id="@+id/list_item_section_text"
android:layout_width="fill_parent"
android:layout_height="match_parent"
layout="@android:layout/preference_category"
android:background="%MY_BACKGROUND%"/>
Run Code Online (Sandbox Code Playgroud)
如果你不是"太深视树偏执"类型的球员,你可以包装您include
在FrameLayout
:
<FrameLayout
android:id="@+id/list_item_section_text"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="%YOUR_BACKGROUND%">
<include layout="@android:layout/preference_category"/>
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
编辑:当然,不要忘记android:background
先从你的preference_category.xml
布局中删除.
您无法为
include
标记添加背景颜色 .
为什么?
很明显,如果你能够给背景颜色include
标记,那么它将全部搞砸了你的include
颜色和另一种可能应用于layout
已经包含的颜色.
归档时间: |
|
查看次数: |
5462 次 |
最近记录: |