I use actionbarsherlock to design tab elements
the main activity looks like :
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.example.speakegypt.R;
import android.support.v4.app.FragmentTabHost;
import android.os.Bundle;
public class MainActivity extends SherlockFragmentActivity {
// Declare Variables
private FragmentTabHost mTabHost;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Set the view from main_fragment.xml
setContentView(R.layout.mainlayouttabhost);
// Locate android.R.id.tabhost in main_fragment.xml
mTabHost = (FragmentTabHost) findViewById(android.R.id.tabhost);
// Create the tabs in main_fragment.xml
mTabHost.setup(this, getSupportFragmentManager(), R.id.tabcontent);
// Search Fragment
mTabHost.addTab(mTabHost.newTabSpec("tab2").setIndicator("Home"),
SearchFragment.class, null);
// Create Tab1 with a custom image in res folder
/*
* mTabHost.addTab(mTabHost.newTabSpec("tab1").setIndicator("",
* getResources().getDrawable(R.drawable.tab1)), FragmentTab1.class,
* null);
*
* // Create Tab2
* mTabHost.addTab(mTabHost.newTabSpec("tab2").setIndicator("Tab2"),
* FragmentTab2.class, null);
*/
}
}
and the maintab containers looks like
<LinearLayout xmlns:android="
http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<android.support.v4.app.FragmentTabHost
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<FrameLayout
android:id="@+id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v4.app.FragmentTabHost>
</LinearLayout>
and first tab looks like
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="
http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<!-- Editext for Search -->
<EditText android:id="@+id/inputSearch"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Search products.."
android:inputType="textVisiblePassword"/>
<!-- List View -->
<ListView
android:id="@+id/Categorylistview"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
the problem is the Edit text and part of the listview behind the home tab , any idea how to fix