如何在一个包括
在Android的标签设置背景颜色?这不能正常工作:
<包括
机器人:ID =@ + ID / list_item_section_text
机器人:layout_width =FILL_PARENT
机器人:layout_height =match_parent
布局=@安卓布局/ preference_category
机器人:背景=%MY_BACKGROUND%/>
解决方案
您能不能给一个背景色为包括
标记。
为什么?
其明显的,如果你能能够给背景颜色为包括
标记那么这将是所有搞砸了你的包括
颜色和可能被应用到布局
其中已经包含了另一种颜色。
How to set background color on an include
tag in Android? This does not work:
<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%"/>
解决方案
You can not give a background color into include
tag.
Why ?
Its obvious , if you could able to give the background color to include
tag then it would be all messed up with your include
color and another color which might be applied to that layout
which has already included .