我有一个扩展ExpandableListActivity的活动.我使用SimpleCursorTreeAdapter来填充ExpandableListView.我的布局包含列表视图和空视图.在应用程序启动时,ExpandableListActivity会自动选择要显示的右视图.
我的步骤:
然后我重启app:
问题:
在SDK上测试:1.5r3,1.6r1
码:
public class MainActivity extends ExpandableListActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
dbHelper = new DBOpenHelper(this);
rubricsDbAdapter = new RubricsDBAdapter(dbHelper);
rubricsDbAdapter.open();
itemsDbAdapter = new ItemsDBAdapter(dbHelper);
itemsDbAdapter.open();
rubricsCursor = rubricsDbAdapter.getAllItemsCursor();
startManagingCursor(rubricsCursor);
// Cache the ID column index
rubricIdColumnIndex = rubricsCursor.getColumnIndexOrThrow(RubricsDBAdapter.KEY_ID);
// Set up our adapter
mAdapter = new MyExpandableListAdapter(rubricsCursor,
this,
android.R.layout.simple_expandable_list_item_1,
android.R.layout.simple_expandable_list_item_1,
new String[] {RubricsDBAdapter.KEY_NAME},
new int[] {android.R.id.text1},
new String[] {ItemsDBAdapter.KEY_NAME},
new int[] …
Run Code Online (Sandbox Code Playgroud)