Android开发-- findViewById()方法得到空指针
时间:2014-09-28 19:03:06
收藏:0
阅读:303
如果想通过调用findViewById()方法获取到相应的控件,必须要求当前Activity的layout通过setContentView. 如果你通过其他方法添加了一个layout,如需获取这个layout中的View对象,首先需inflate这个layout,然后在该layout上调用findViewById().
1 View v = inflater.inflate(id_number_of_layout); 2 View innerView = v.findViewById(id_number_of_view_inside_v);
原文:http://www.cnblogs.com/feiling/p/3998684.html
评论(0)