Android : How to inherit style in layout in Android

on Wednesday, September 3, 2014


I've tried to inherit styles in Android layout xml. Now it looks like:


layout.xml:



<RelativeLayout
android:id="@id/btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
style="@style/AppTheme.ButtonLayout">

<TextView
android:id="@id/btn_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AppTheme.ButtonLayout.TextView" />

</RelativeLayout>


styles.xml:



<style name="AppTheme.ButtonLayout">
<item name="android:textViewStyle">@style/AppTheme.ButtonLayout.TextView</item>
</style>

<style name="AppTheme.ButtonLayout.TextView" parent="android:Widget.Holo.Light.TextView">
<item name="android:textColor">@android:color/white</item>
</style>


I want to get rid of style attribute from the TextView, but it should inherit appearance from RelativeLayout. Is it possible?


0 comments:

Post a Comment