Questions tagged «drawer»

12
在不同活动中使用相同的导航抽屉
我做了一个工作的导航抽屉,就像在developer.android.com网站上的教程中显示的那样。但是现在,我想使用一个在NavigationDrawer.class中创建的导航抽屉,用于我的应用程序中的多个Activity。 我的问题是,如果这里有人可以做一点教程,它说明了如何将一个导航抽屉用于多个活动。 我首先在这个关于多个活动的 Answer Android导航抽屉中阅读了它 但是在我的项目上不起​​作用 public class NavigationDrawer extends Activity { public DrawerLayout drawerLayout; public ListView drawerList; private ActionBarDrawerToggle drawerToggle; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); drawerToggle = new ActionBarDrawerToggle((Activity) this, drawerLayout, R.drawable.ic_drawer, 0, 0) { public void onDrawerClosed(View view) { getActionBar().setTitle(R.string.app_name); } public void …

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.