开发者

how to access UI element values in layout.filename

I have made a custom class extending Preferences. I have used that custom class in a XML layout file and need to access the values there. part of my layout file:

<MyCustomClass
android:id="@+id/custom01"
android:title="ineedthistext" />

How can I retrieve "ineedthistext" as a s开发者_如何学Ctring?


Via the class constructor:

public MyCustomClass(Context context, AttributeSet attrs) {
    ...
    // Get an attribute
    X var = attrs.getX(...);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜