0
打開兩個抽屜式導航
The above code is for xml changes.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="com.example.ensivo4.mobileapp.SubActivity"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<include
layout="@layout/appbarmain"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="@+id/nav_left_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:accessibilityLiveRegion="none">
<include layout="@layout/navheadermain"/>
</android.support.design.widget.NavigationView>
<android.support.v4.widget.DrawerLayout
android:id="@+id/inner_drawer_layout"
android:layout_width="280dp"
android:layout_height="match_parent"
android:layout_gravity="right">
<android.support.design.widget.NavigationView
android:id="@+id/nav_right_view"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/rightdrawer"/>
</android.support.design.widget.NavigationView>
<android.support.design.widget.NavigationView
android:id="@+id/login_navigation_view"
android:layout_width="270dp"
android:layout_height="match_parent"
android:layout_gravity="right"
app:headerLayout="@layout/nav_header_main_myaccount"
app:menu="@menu/menu_myaccount" />
</android.support.v4.widget.DrawerLayout>
</android.support.v4.widget.DrawerLayout>
這是內部抽屜式導航爲我的帳戶抽屜式導航。我有第一LoginPage和第二是我對rightDrawer .openInnerDrawer(賬戶),同時對登錄按鈕點擊被稱爲這可在loginPage抽屜中找到。如何從右側上AppCompatActivity
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); // this is Main Drawwwer For left and right
rightNavigationView = (NavigationView) findViewById(R.id.nav_right_view); // this is for right Drawer
private void openInnerDrawer() {
innerDrawerLayout = (DrawerLayout) findViewById(R.id.inner_drawer_layout);
innerDrawerLayout.openDrawer(Gravity.RIGHT);
innerDrawerLayout.setScrimColor(Color.TRANSPARENT);
// innerDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
LoginNavigationView =(NavigationView) findViewById(R.id.login_navigation_view);
LoginNavigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.nav_Orders) {
Toast.makeText(SubActivity.this, "Right Drawer - Settings", Toast.LENGTH_SHORT).show();
} else if (id == R.id.nav_Favorite_list) {
Toast.makeText(SubActivity.this, "Right Drawer - Logout", Toast.LENGTH_SHORT).show();
} else if (id == R.id.nav_Address) {
Toast.makeText(SubActivity.this, "Right Drawer - Help", Toast.LENGTH_SHORT).show();
} else if (id == R.id.nav_track_my_order) {
Toast.makeText(SubActivity.this, "Right Drawer - About", Toast.LENGTH_SHORT).show();
}
else if (id == R.id.nav_coupons) {
Toast.makeText(SubActivity.this, "Right Drawer - About", Toast.LENGTH_SHORT).show();
}
else if (id == R.id.nav_saved_cards) {
Toast.makeText(SubActivity.this, "Right Drawer - About", Toast.LENGTH_SHORT).show();
}
else if (id == R.id.nav_Setting) {
Toast.makeText(SubActivity.this, "Right Drawer - About", Toast.LENGTH_SHORT).show();
}
else if (id == R.id.nav_logout) {
Toast.makeText(SubActivity.this, "Right Drawer - Logout", Toast.LENGTH_SHORT).show();
closeInnerDrawer();
}
return true;
}
});
//innerDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_OPEN);
}
謝謝你this.But問題還沒有解決plz chk我的coad。它不給結果,因爲我想要 –
沒有那不是變化。我會更新我的更改 –
Plz chk我對xml和活動的更改。 –