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


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.

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

Adding Menu Items

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

And also add following strings in your strings.xml file.

Adding DrawerLayout and NavigationView in your XML Activity Layout File

Following is the final code of your activity_main.xml file.

MainActivity.java File

Your MainActivity.java file looks like this.

Create ViralAndroidActivity.java and GoogleActivity.java File

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


Create viral_android.xml and google.xml File

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


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.

Don’t forget to add sliding menu icon in your drawable folder.

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.

Post a Comment

Powered by Blogger.