Reputation: 10590
is there a way to define a style that affects all Views in an Activity of a given type, without editing all of the xml View tags to define the style. is there a way to define something like "all TextViews in this Activity have a minHeight of 70sp"?
Upvotes: 0
Views: 1193
Reputation: 87064
A theme is what you want. Each android widget has a default style that you could override to make it as you want. For example:
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="TextViewSpecial" parent="@android:style/Theme">
<item name="android:textViewStyle">@style/SpecialTextView</item>
</style>
</resources>
a theme that overrides the style for a TextView
. SpecialTextView
is a style like this:
<style name="SpecialTextView" parent="@android:style/Widget.TextView">
<item name="android:minHeight">70sp</item> <!-- use dp instead of sp --
</style>
Then simply set the TextViewSpecial
theme in the manifest to the desired activity. You can use this method to ovreride the style of what widget you want.
Upvotes: 1