2

My xml is:

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<LinearLayout 
    android:id="@+id/LinearLayout01"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical">

<LinearLayout
    android:id="@+id/LinearLayout02"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TabWidget
        android:id="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >
    </TabWidget>

    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >
    </FrameLayout>
</LinearLayout>

<Button
    android:id="@+id/btnsubmit"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/btnsubmit" />

</LinearLayout>

and java file:

package com.harrbinger.formdesign;

import android.os.Bundle;
import android.app.TabActivity;
import android.content.Intent;
import android.view.Menu;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class FormActivity extends TabActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_form);

    TabHost tabHost = (TabHost)findViewById(android.R.id.tabhost);


    TabSpec tab1 = tabHost.newTabSpec("First Tab");
    TabSpec tab2 = tabHost.newTabSpec("Second Tab");
    TabSpec tab3 = tabHost.newTabSpec("Third tab");

    tab1.setIndicator("Tab1");
    tab1.setContent(new Intent(this,Generaldata.class));

    tab2.setIndicator("Tab2");
    tab2.setContent(new Intent(this,Production.class));

    tab3.setIndicator("Tab3");
    tab3.setContent(new Intent(this,Financial.class));

    tabHost.addTab(tab1);
    tabHost.addTab(tab2);
    tabHost.addTab(tab3);
}


@Override
public boolean onCreateOptionsMenu(Menu menu) {

    getMenuInflater().inflate(R.menu.form, menu);
    return true;
}

}

I want The Submit Button to be available on every Tab. The current xml is not working. If I put it outside TabHost, the button is displayed but but above the tab host.

Help Please

Amarjit
  • 4,327
  • 2
  • 34
  • 51
SurajS
  • 473
  • 7
  • 20
  • `If I put it outside TabHost`. Can we get more information on how you do that? Legit xml has one root element, in your case, you simply can't put anything outside the TabHost. – Marius Feb 09 '15 at 12:13
  • yes, but i just tried. That way it at least showing the button. other ways its not even showing. – SurajS Feb 09 '15 at 12:44
  • If you add the code how you tried that, maybe we will be able(willing) to help. So far, I don't see you putting any effort into solving the problem. – Marius Feb 09 '15 at 12:58

0 Answers0