Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Using web view to build a native android app with native navigation and not web navigation.

Hello everyone! :)

Am new to treehouse. A friend of mine directed me here. I have watched Android tutorial by Ben Jakuben and I have to say this guy is super awesome and that goes to all treehouse tutors.

At the end of the Building a blog reader for android project, Ben Jakuben illustrated on how you can incorporate a web view within your native Android app

My question is, How can I use android web view and build an app similar to this alt text

What do I mean by similar to this? Having an application were we use native navigation but the displayed content being a web view.

Any assistance is highly appreciated. Thank you very much.

2 Answers

Ben Jakuben
Ben Jakuben
Treehouse Teacher

Hi Michael Ntambazi,

Thanks for the kind words! Glad you are here learning with us. :)

Your image isn't showing, so I'm not sure what kind of example you want. If you can link to or include another image using Markdown syntax (see the cheat sheet link at the bottom of this page) then perhaps we can give you some insight.

It sounds like you will want to create an Activity that includes native controls as layout elements as well as a WebView that fills the rest of the screen layout.

Hi Ben Jakuben ,

Here is the image below. I wanna develop an android app with such kind of navigation and tabs. alt text

Ben Jakuben
Ben Jakuben
Treehouse Teacher

Okay. For what it's worth, Android conventions are to put tabs on the top of the view, but that's not a hard and fast rule. :)

Anyhow, what you need is a layout that's divided into three parts. Give it a stab and paste your code in here and then we can work from there. The trick is to think about dividing the screen into rectangles. You want three rectangles here: one at the top, a big one in the middle, and one at the bottom.

Assuming your activity layout is a RelativeLayout, add a RelativeLayout at the top. This will be the blue row at the top, the 1st rectangle. Inside this new RelativeLayout you will need buttons to correspond to what you are showing in the screenshot.

Then you'll need another RelativeLayout at the bottom for the tabs (the 3rd rectangle). Inside this RelativeLayout, again add 4 Buttons to match the screenshot.

The middle rectangle will be filled with a WebView. You'll need to play around with the settings for each item to get them positioned how you want them. I am covering layouts in more detail in my upcoming project, but if you get started with this, paste in your code and I or other students can help you from there.

Your are the best! :) Let me start off like you've said and if i get any problems, I will shout it out in the forum for help. Thanks a lot for the great work though. I appreciate and I enjoy watching and all your lessons.