在主细节流模板中使用导航抽屉

时间:2014-02-02 12:30:07

标签: android

如何使用Eclipse和Android SDK在主详细信息模板中的ItemListActivity.java文件中使用以下代码。 由于此页面代码最初有一个oncreate包代码,后来它有一个用于两个窗格代码....

final String[] data ={"one","two","three"};
final String[] fragments ={
        "org.arthakrantipratishthan.arthakranti.CommunityFragment",
        "org.arthakrantipratishthan.arthakranti.PagesFragment",
        "org.arthakrantipratishthan.arthakranti.HomeFragment"};
@Override
protected void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.activity_item_list);

     ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActionBar().getThemedContext(), android.R.layout.simple_list_item_1, data);

     final DrawerLayout drawer = (DrawerLayout)findViewById(R.id.drawer_layout);
     final ListView navList = (ListView) findViewById(R.id.drawer_layout);
     navList.setAdapter(adapter);
}

0 个答案:

没有答案