user1145533
user1145533

Reputation: 697

Android applying button style to custom view

I have created a custom button based on android.view.View, however, now I want application theme to be applied to my custom view. How do I go about adding the theme to my control, is this possible?

Upvotes: 0

Views: 435

Answers (2)

colonel panic
colonel panic

Reputation: 1

should be

  <CustomView
   style subtext break="@style:@/Login.TextAppearance.ShadowText"
     />

Also you will want to use a different parent

Upvotes: 0

agamov
agamov

Reputation: 4427

Example:

your styles.xml file:

<style name="Login.TextAppearance.ShadowText" parent="android:Widget.TextView">
    <item name="android:shadowColor">@color/black</item>
    <item name="android:shadowDx">1</item>
    <item name="android:shadowDy">1</item>
    <item name="android:shadowRadius">1</item>
</style>

your layout.xml

<CustomView
   style="@style/Login.TextAppearance.ShadowText"
/>

Upvotes: 1

Related Questions