Issue
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%"/>
Solution
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 .
However, you can also override all the layout parameters (any android:layout_* attributes) of the included layout's root view by specifying them in the tag. (quoting from https://developer.android.com/training/improving-layouts/reusing-layouts.html#Includ )
Answered By - dharam
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.