Android Studio 1.5
I have this layout called chat_profile_header , which will be used in many layouts. I set background to indigo color. The problem is that when I include this title in other layouts, I want to be able to change the background color based on this layout theme. Everything in the title will remain the same.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="60dp" android:background="@color/profile_header_indigo_500"> <de.hdodenhof.circleimageview.CircleImageView android:id="@+id/profile_image" android:layout_width="40dp" android:layout_height="40dp" android:src="@drawable/photorace" android:layout_centerVertical="true"/> <TextView android:id="@+id/tvProfileName" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/profile_image" android:layout_toEndOf="@id/profile_image" android:layout_centerVertical="true" android:layout_marginLeft="8dp" android:fontFamily="sans-serif" android:textColor="@android:color/white"/> </RelativeLayout>
Here I use the header included in this layout. However, based on this topic, I want to change the title to a different background color, gray. However, I don't think I can override the background color attribute.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/white"> <include layout="@layout/chat_profile_header" android:background="@color/child_header_lighter_grey"/> <android.support.v7.widget.RecyclerView android:id="@+id/rvParentList" android:layout_width="match_parent" android:layout_height="wrap_content"> </android.support.v7.widget.RecyclerView> </LinearLayout>
Is there a way to do this without creating different background layouts for the headers. There seems to be a lot of duplication.
android android-layout
ant2009
source share