What is AttributeSet and how can i use it?

前端 未结 4 531
谎友^
谎友^ 2020-12-24 00:04

What is AttributeSet in Android?

How can i use it for my custom view?

4条回答
  •  死守一世寂寞
    2020-12-24 00:44

    AttributeSet is the set of properties specified in an xml resource file. You shouldn't have to do anything special in your custom view. The View(Context context, AttributeSet attrs) gets called to initialize a view from a layout file. Just add this constructor to your custom view. Check out the Custom View example in the SDK to see it used.

提交回复
热议问题