Monday, 27 May 2013

inheritance with android style

I have defined red color to contentBg style for TextView. Can i change the TextView color red to blue by changing or renaming style name myContentNew from the parent style? The TextView style name-contentBG should not be changed. Is it possible in android sytle.
<RelativeLayout
   style="@style/myContent"
   android:layout_width="fill_parent"
   android:layout_height="wrap_content">
<TextView
   style="@style/contentBG"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"/>
</RelativeLayout>
My code should be like below
<RelativeLayout
       style="@style/myContentNew"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content">
    <TextView
       style="@style/contentBG"
       android:layout_width="fill_parent"
       android:layout_height="fill_parent"/>
 </RelativeLayout>
You can get clear idea with my attached image.
Thanks

No comments:

Post a Comment