简体   繁体   中英

Navigation Drawer Layout Open

I'm developing an Android application, I use navigation drawer as layout, i would know if is It possible that when the application starts the side menu remains open.

Actually At startup the menù remains closed.

Try using

drawer.openDrawer(Gravity.LEFT);

where

final DrawerLayout drawer = (DrawerLayout)findViewById(R.id.drawer_layout);

This line:

drawer.openDrawer(Gravity.LEFT);

will open your drawer, so you just need to call it on start up of your activity, for example:

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        drawer.openDrawer(Gravity.LEFT); // you can change the gravity to right if your drawer is rtl


}

any problem, just ask

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM