开发者

load an xml into the Class View

I am new in android I have created 2 classes.first extends activity and 2nd extends 开发者_高级运维View. I want to add buttons,image Views etc. into the second class How can I do this?


Take a look at inflate in the View class, this allows you to inflate an arbitrary XML-file which is then added to a specific ViewGroup:

http://developer.android.com/reference/android/view/View.html#inflate(android.content.Context, int, android.view.ViewGroup)

Usage:

View.inflate(context, R.id.my_layout_file, myViewGroup);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜