默认情况下打开菜单导航抽屉android

时间:2014-06-02 06:17:08

标签: android navigation-drawer

我想知道默认情况下是否有办法打开导航菜单?

我的应用程序基于此菜单,因此如果默认情况下导航菜单未打开,则看起来我的应用程序是空的。

我的偏好是XML。

感谢您的帮助!

1 个答案:

答案 0 :(得分:3)

// Delay is in milliseconds
static final int DRAWER_DELAY = 200;

@Override
protected void onCreate(Bundle savedInstanceState) {
    ...
    // Building NavDrawer logic here. Just a method call would be best.
    ...
    new Handler().postDelayed(openDrawerRunnable(), DRAWER_DELAY);
}

private Runnable openDrawerRunnable() {
    return new Runnable() {

        @Override
        public void run() {
            drawerLayout.openDrawer(Gravity.LEFT);
        }
    }
}