I´m making a web browser application for Android and I´m having some serious problems with the views. My aim is to have 3 tabs with identical content but independant from each other (so that you can visit three different web sites at the same time, one per tab).

Screenshot: http://imgur.com/x96to

Below the TabHost, I want it to be a small panel with a EditText (searchfield) and a few buttons to the left and the right of the searchfield. Below the panel I want it to be a WebView.

As it is now, I have three tabs with three independant WebViews, but I can´t solve adding the panel above the WebView. The Panel is made in xml and the WebView is created in java.

As you may notice in the following code I´m thinking about making my own CustomView but I don´t really now if it´s a good idea and how to do it properly. And then where do I put my OnClicks for the panelbuttons?

Please help me with at least some directions!

Code:

 setupTab(new WebView(this), "1");
    setupTab(new WebView(this), "2");
    setupTab(new WebView(this), "3");

private void setupTab(final View view, final String tag) {
    View tabview = createTabView(mTabHost.getContext(), tag);
    TabSpec ourSpec = mTabHost.newTabSpec(tag).setIndicator(tabview)
            .setContent(new TabContentFactory() {
                public View createTabContent(String tag) {
                    return new CustomView(ExampleActivity.this);
                }

            });
    mTabHost.addTab(ourSpec);
}

private static View createTabView(final Context context, final String text) {
    View view = LayoutInflater.from(context)
            .inflate(R.layout.tabs_bg, null);
    return view;
}

asked 18 Mar '12, 15:03

ScummT's gravatar image

ScummT
111
accept rate: 0%

Be the first one to answer this question!
toggle preview


Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×2
×1
×1
×1

Asked: 18 Mar '12, 15:03

Seen: 232 times

Last updated: 18 Mar '12, 15:03