问题描述
添加ListView后,操作栏不可见,能否请您告诉我使其再次可见?此外,如何在此Java文件中创建SearchView?
MainActivity.java
public class MainActivity extends ListActivity {
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
// 1. pass context and data to the custom adapter
MyAdapter adapter = new MyAdapter(this, generateData());
//2. setListAdapter
setListAdapter(adapter);
}
private ArrayList<Item> generateData(){
ArrayList<Item> items = new ArrayList<Item>();
items.add(new Item("item1","description1"));
items.add(new Item("item2", "description2"));
items.add(new Item("item3", "description3"));
return items;
}
}
1楼
我认为您应该将AppCompatActivity与ListActiv插入的ListView一起使用