// Handle navigation view item clicks here.
int id = item.getItemId();
if (id == R.id.menu) {
// Handle the camera action
wv.loadUrl("file:///android_asset/menu.html");
} else if (id == R.id.dars1) {
wv.loadUrl("file:///android_asset/dars1.html");
} else if (id == R.id.dars2) {
wv.loadUrl("file:///android_asset/dars2.html");
} else if (id == R.id.dars3) {
wv.loadUrl("file:///android_asset/dars3.html");
} else if (id == R.id.dars4) {
wv.loadUrl("file:///android_asset/dars4.html");
} else if (id == R.id.dars5) {
wv.loadUrl("file:///android_asset/dars5.html");
} else if (id == R.id.dars6) {
wv.loadUrl("file:///android_asset/dars6.html");
} else if (id == R.id.dars7) {
wv.loadUrl("file:///android_asset/dars7.html");
}else if (id == R.id.dars8) {
wv.loadUrl("file:///android_asset/dars8.html");
}else if (id == R.id.dars9) {
wv.loadUrl("file:///android_asset/dars9.html");
}else if (id == R.id.dars10) {
wv.loadUrl("file:///android_asset/dars11.html");
}else if (id == R.id.dars11) {
wv.loadUrl("file:///android_asset/dars11.html");
}else if (id == R.id.dars12) {
wv.loadUrl("file:///android_asset/dars12.html");
}else if (id == R.id.dars13) {
wv.loadUrl("file:///android_asset/dars13.html");
}else if (id == R.id.dars14) {
wv.loadUrl("file:///android_asset/dars14.html");
}else if (id == R.id.dars15) {
wv.loadUrl("file:///android_asset/dars15.html");
}else if (id == R.id.dars16) {
wv.loadUrl("https://korrespondent.uz");
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
}
#Activity_mani.xml
xml version="1.0" encoding="utf-8"?>
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
layout="@layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer" />
#App_bar_main
xml version="1.0" encoding="utf-8"?>
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#7D40BF"
app:popupTheme="@style/AppTheme.PopupOverlay" />
#nav_headr_main
Do'stlaringiz bilan baham: |