On 10 Lut, 16:34, ying lcs <[email protected]> wrote:
> Hi,
>
> I am writing a custom button.
>
> In the android button, I can customize my button like this:
> <Button android:id="@+id/subtract_button"
> android:text="-"
> />
>
> And in the Button.java source code, it gets the value like that:
> In TextView.java:
> case com.android.internal.R.styleable.TextView_text:
> text = a.getText(attr);
> break;
>
> My question is if I need to add a new value in the customization for my
> button.
> <MyButton android:id="@+id/subtract_button"
> android:text="-"
> android:myattribute="myvalue"
> />
>
> How can I get 'myattribute' in my class for my custom button?
>
> Thank you.
you should create your styleable attribute by defining declare-
styleable in attrs.xml (see android's attrs.xml for more info)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---