[英]ActionBar tabs without fragments?
In my app I'm trying to use a custom ListView, found here: 在我的应用中,我尝试使用自定义ListView,可在以下位置找到:
http://www.hmkcode.com/android-custom-listview-titles-icons-counter http://www.hmkcode.com/android-custom-listview-titles-icons-counter
and I can't load the models: 我无法加载模型:
Adapter Release = new Adapter(this, generateData());
// if extending Activity 2. Get ListView from activity_main.xml
ListView listView = (ListView) findViewById(R.id.listView1);
// 3. setListAdapter
listView.setAdapter(Release);
}
private ArrayList<Model> generateData() {
ArrayList<Model> models = new ArrayList<Model>();
models.add(new Model("Group Title"));
models.add(new Model(R.drawable.action_help_32,"Menu Item 1","1"));
models.add(new Model(R.drawable.action_search_32,"Menu Item 2","2"));
models.add(new Model(R.drawable.collections_cloud_32,"Menu Item 3","12"));
return models;
in the onCreateView
在
onCreateView
Is there a way to setup ActionBar tabs and change content, rather than fragments? 有没有一种方法可以设置ActionBar选项卡并更改内容,而不是片段?
You can set data to adapter dynamically. 您可以将数据动态设置为适配器。 You need to call
notifyDataSetChanged()
on adapter after setting data. 设置数据后,需要在适配器上调用
notifyDataSetChanged()
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.