在ViewPager中嵌套ListView,布局文件该怎么弄
1个回答
展开全部
LayoutInflater mInflater = getLayoutInflater();
View v1 = mInflater.inflate(R.layout.first_frag, null);
ListView first_listview = (ListView) v1.findViewById(R.id.first_listview);
继承fragment类似应该放
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.menu_list, null);
// findID(view);
ListView first_listview = (ListView) v1.findViewById(R.id.first_listview);
return view;
}
继承activity般放onCreat()面
listview般用adapter填充填充类实现OnItemClickListener
first_listview.setOnItemClickListener(this);
public void onItemClick(AdapterView av, View arg1, int position, long arg3) {
//用处理listview点击
}
希望能够帮
View v1 = mInflater.inflate(R.layout.first_frag, null);
ListView first_listview = (ListView) v1.findViewById(R.id.first_listview);
继承fragment类似应该放
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.menu_list, null);
// findID(view);
ListView first_listview = (ListView) v1.findViewById(R.id.first_listview);
return view;
}
继承activity般放onCreat()面
listview般用adapter填充填充类实现OnItemClickListener
first_listview.setOnItemClickListener(this);
public void onItemClick(AdapterView av, View arg1, int position, long arg3) {
//用处理listview点击
}
希望能够帮
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询