Loading...

Android Sliding Menu with WebView

In this tutorial, I’m going to show how to make android sliding menu with WebView. Android WebView is a View that displays any website to your android application. You can also find many android navigation drawer view libraries in the internet and you can find many android WebView tutorials at Android WebView Tutorial with Example.

Android Sliding Menu with WebView






Related:
Best Navigation Drawer Libraries for Android Project
Navigation Drawer View User Interface (UI) Design for Android
Android Navigation Drawer View: Material Design Support Library

Android Sliding Menu with WebView Demo


Android Sliding Menu with WebView

Create a new Android Project


Let’s start by creating a new android project to make Android Sliding Menu with WebView with the following information.
Application Name: Sliding Menu
Company Domain: viralandroid.com
Package Name: com.viralandroid.slidingmenu
Minimum SDK: Android 2.2 (API 8 Froyo)

Add Design Support Library Dependency


Add design support library dependency in your build.gradle file which looks like this.

Modify your styles.xml file


Add colorPrimary, colorPrimaryDark and change your app theme. The final code of your styles.xml file looks like this.
res/values/styles.xml

And also create colors.xml file in your value directory and add following colors.
res/valuers/colors.xml

Adding Menu Items


To add menu items, you have to create navigation_items.xml file in your menu directory.
res/menu/navigation_items.xml

And also add following strings in your strings.xml file.
res/values/strings.xml

Adding DrawerLayout and NavigationView in your XML Activity Layout File


Following is the final code of your activity_main.xml file.
res/layout/activity_main.xml

MainActivity.java File


Your MainActivity.java file looks like this.
src/MainActivity.java

Create ViralAndroidActivity.java and GoogleActivity.java File


After Creating ViralAndroidActivity.java and GoogleActivity.java file, add following code.
src/ViralAndroidActivity.java

src/GoogleActivity.java

Create viral_android.xml and google.xml File


Following is the final xml code of viral_android.xml and google.xml file.
res/layout/viral_android.xml

res/google.xml

Add Internet Permission in AndroidManifest.xml File


You have to add internet permission in AndroidManifest.xml file of your application.
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
Following is the final modified code of AndroidManifest.xml file.

And default code of menu_main.xml file looks like this.
res/menu/menu_main.xml

Don’t forget to add sliding menu icon in your drawable folder.
res/drawable/google.png
res/drawable/ic_launcher.png
res/drawable/viral_android.png

That’s it. Now, run your Sliding Menu with WebView application.

Download Complete Example Project

Download complete Android Sliding Menu with WebView example project source code from GitHub.
WebView 687280705886983019
Home item