我有xml布局,我想从它创建视图-我需要它的编程。有可能吗?
发布于 2011-11-04 18:33:16
是的。你必须像这样使用充气服务
LayoutInflater li=(LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
yourview=li.inflate(R.layout.yourlayout, null);发布于 2011-11-04 18:32:46
将您的xml放在某个名称为x的layout文件夹中。
使用getViewInflate().inflate(R.layout.x,null,null)创建视图。
https://stackoverflow.com/questions/8007899
复制相似问题