Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom TextView in Button

I have created one custom textview class. Through this class, i can set the fonts, set innershadow of the text, set outershadow of the text, set the radius and color of the text.I want to use these characteristics of textviews in the text present in button as well. I have researched through google but i have not been able to find that solution which solves my problem. So, if anybody has any ideas on this topic, then you will be of a great help.

Properties that i define in my textview are

    xmlns:braindigit="http://schemas.android.com/apk/res/com.example.MyCustomTextView" //this is in the main layout        

   <com.example.MyCustomTextView
    android:id="@+id/stateInfo"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/you_are_not_logged_in"
        android:textColor="#3191d2"
        android:textSize="18sp"
        android:textStyle="bold"
        braindigit:innerShadowColor="#003456"
        braindigit:innerShadowDy="1"
        braindigit:innerShadowRadius="1"
        braindigit:outerShadowColor="#ffffff"
        braindigit:outerShadowDy="1"
        braindigit:outerShadowRadius="1" />

Theres no problem with the custom textview.But, i dont know how can i use these custom textvalues for my button.

like image 241
Prativa Avatar asked Dec 20 '25 05:12

Prativa


1 Answers

If your custom class extends TextView, you can just use the same implementation and extend Button. Button inherits from TextView.

like image 93
Andy McSherry Avatar answered Dec 22 '25 21:12

Andy McSherry



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!