当我们设置一个带汉堡包的抽屉时,hamuburger位于工具栏的center_vertical中,但如果我们更改工具栏的高度,汉堡包不会移动,我该如何将它放在中心(垂直)? / p>
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, mToolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
assert drawer != null;
drawer.setDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
assert navigationView != null;
navigationView.setNavigationItemSelectedListener(this);
----//----
<android.support.v7.widget.Toolbar
android:id="@+id/mToolbar"
android:background="#303f9f"
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="40dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
/>
答案 0 :(得分:0)
使用minHeight attributte
android:minHeight="40dp"