I wrote a custom view that extends RelativeLayout
. My view has text, so I want to use the standard android:text
without the need to specify a <declare-styleable>
and without using a custom namespace xmlns:xxx
every time I use my custom view.
this is the xml where I use my custom view:
<my.app.StatusBar
android:id="@+id/statusBar"
android:text="this is the title"/>
How can I get the attribute value? I think I can get the android:text attribute with
TypedArray a = context.obtainStyledAttributes(attrs, ???);
but what is ???
in this case (without a styleable in attr.xml)?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…