标签:
布局加载的方式:
listview中适配器getView方法里获取获取布局控件的方法:
//第一种--获得布局加载器
LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = layoutInflater.inflate(R.layout.listview_item_city, null);
//第二种
LayoutInflater layoutInflater2 = LayoutInflater.from(MainActivity.this);
View view = layoutInflater2.inflate(R.layout.listview_item_city, null);
//第三种
LayoutInflater layoutInflater = MainActivity.this.getLayoutInflater();
View view = layoutInflater.inflate(R.layout.listview_item_city, null);
//第四种
View view = View.inflate(MainActivity.this, R.layout.listview_item_city, null);
标签:
原文地址:http://www.cnblogs.com/fangg/p/5916043.html