I have 2 tabs: Report and Profile.
I want to add a different form (Textview, spinner, etc) in each of the tabs. For now im trying with a button and it should be different button in different tab.
But what i get is i have the same button in both tab. It should show button name ButtonReport in Report Tab and ButtonProfile in Profile Tab.
Below is the picture of it.
I am putting the button code in main.xml.
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#android:id/tabhost"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<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">
<!-- Start Interface -->
<TableLayout android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="#+id/tableLayout1" android:alwaysDrawnWithCache="false">
<TableRow android:layout_height="fill_parent" android:id="#+id/tableRow3">
<TableLayout android:id="#+id/tableLayout2" android:layout_width="wrap_content" android:layout_height="wrap_content">
<Button android:text="Button Report" android:id="#+id/button1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
</TableLayout>
</TableRow>
</TableLayout>
<!-- End Interface -->
</FrameLayout>
</LinearLayout>
</TabHost>
This is my ReportActivity class and ProfileActivity(same code only different name)
package com.tab;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class ReportActivity extends Activity{
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
TextView text = new TextView(this);
text.setText("Artist");
setContentView(text);
}
}
This is my MainActivity class
package com.tab;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;
public class MainActivity extends TabActivity {
private TabHost aTab;
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Resources res = getResources();
aTab = getTabHost();
TabHost.TabSpec spec;
Intent intent;
//Report Tab
intent = new Intent(this, ReportActivity.class);
spec = aTab.newTabSpec("Report")
.setIndicator("Report", res.getDrawable(R.drawable.tab_icon))
.setContent(intent);
aTab.addTab(spec);
//Profile Tab
intent = new Intent(this, ProfileActivity.class);
spec = aTab.newTabSpec("Profile")
.setIndicator("Profile", res.getDrawable(R.drawable.tab_icon))
.setContent(intent);
aTab.addTab(spec);
aTab.setCurrentTab(1);
}
}
is there a way to have different form in different tab?
The best way (my opinion) is to use Fragments :
http://developer.android.com/guide/components/fragments.html
Fragment are for API Level 11 minimum, but you can work with a compatibility package :
http://android-developers.blogspot.ch/2011/03/fragments-for-all.html
So every tab will become a fragment.
Have a look at TabHost tutorial And, just look how they're using Different Contents in their TabHost For Example -
main.xml
<?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:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget
android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</LinearLayout>
</TabHost>
Report.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Screen Design for Photos -->
<Button android:text="Button Report"
android:textSize="18dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
Profile.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Screen Design for Photos -->
<Button android:text="Button Profile"
android:textSize="18dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
In your main.xml class contain some different thing that is Start Interface This is the problem that to display the same content (Button) is every tab. You've to remove this.
And, in your Profile and Report activities just view this xml file using setContentView This will provide the seperate buttons which you need. You can use MainActivity for this, it seems perfect.
Hope this helps you.
You can set different layout xml's for each activity (report and profile):
Source: http://www.androidhive.info/2011/08/android-tab-layout-tutorial/
First make an activity called TabHostActivity:
import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;
public class TabHostActivity extends TabActivity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TabHost tabHost = getTabHost();
TabSpec report = tabHost.newTabSpec("Report");
report.setIndicator("Report", getResources().getDrawable(R.drawable.icon_report));
Intent reportIntent = new Intent(this, report.class);
report.setContent(reportIntent);
TabSpec profile = tabHost.newTabSpec("Profile");
profile.setIndicator("Profile", getResources().getDrawable(R.drawable.icon_profile));
Intent profileIntent = new Intent(this, profile.class);
profile.setContent(profileIntent);
// Adding all TabSpec to TabHost
tabHost.addTab(report); // Adding photos tab
tabHost.addTab(profile); // Adding songs tab
}
}
then make Main.xml under res/layouts:
<?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:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget
android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</LinearLayout>
</TabHost>
Then two different activities that will do your actions for report and profile:
//report.java
package com.example;
import android.app.Activity;
import android.os.Bundle;
public class ReportActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.report_layout);
}
}
//profile.java
package com.example;
import android.app.Activity;
import android.os.Bundle;
public class ProfileActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.profile_layout);
}
}
Now you can make your two XML's, one for the profile layout and one for the report layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView android:text="Profile"
android:padding="15dip"
android:textSize="18dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
And
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView android:text="Report"
android:padding="15dip"
android:textSize="18dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
Once that is done you can modify each xml to have whatever buttons and spinners, etc. you like.
Lastly, make sure you modify your AndroidManifest to allow the activities and auto-launch via the intent filters to your tabhostactivity
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="7" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".TabHostActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".profile" />
<activity android:name=".report" />
</application>
I think this piece of code will help you.You can use different intents to call different tab activity..And you can set different content views to different activities..
public class MainActivity extends TabActivity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setContentView(R.layout.activity_main);
Resources ressources = getResources();
TabHost tabHost = getTabHost();
//Setting Android TAB
Intent intentAndroid = new Intent().setClass(this, AndroidTab.class);
TabSpec tabSpecAndroid = tabHost
.newTabSpec("Android")
.setIndicator("", ressources.getDrawable(R.drawable.android))
.setContent(intentAndroid);
//Setting Apple TAB
Intent intentApple = new Intent().setClass(this, AppleActivity.class);
TabSpec tabSpecApple = tabHost
.newTabSpec("Apple")
.setIndicator("", ressources.getDrawable(R.drawable.aapl))
.setContent(intentApple);
//Add all tabs
tabHost.addTab(tabSpecAndroid);
tabHost.addTab(tabSpecApple);
tabHost.setCurrentTab(0);
}
}
After you should create different classes and make two activities for android and apple.In that particular activities you can set different contentviews and I think you will get what you wanted.This is just a sample you can make it what you want as the same..
Related
I am trying to create an app that starts with an activity A with a "custom" layout. From that activity it is possible to enter activity B with 3 tabs.
I succeed at creating activity with tabs. The problem is that tabs shows up only if that activity is also launcher activity. If it is not, the tabs do not shows up.
At first time i tried to create tabs with TabLayout. Now i tried to create tabs with TabHost.
Can someone pleas help?
onCreate method in main activity where tabs are "created".
public class GlavnaStran extends TabActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_glavna_stran);
TabHost tabHost = (TabHost)findViewById(android.R.id.tabhost);
TabHost.TabSpec tab1 = tabHost.newTabSpec("Search");
TabHost.TabSpec tab2 = tabHost.newTabSpec("Lyric");
TabHost.TabSpec tab3 = tabHost.newTabSpec("Playlist");
//tab1.setIndicator("Tab1");
tab1.setIndicator("Search");
tab1.setContent(new Intent(this, SearchTab.class));
//tab2.setIndicator("Tab2");
tab2.setIndicator("Lyric");
tab2.setContent(new Intent(this, LyricTab.class));
//tab3.setIndicator("Tab3");
tab3.setIndicator("Playlist");
tab3.setContent(new Intent(this, PlaylistTab.class));
tabHost.addTab(tab1);
tabHost.addTab(tab2);
tabHost.addTab(tab3);
}
}
For each tab i was created separate activity which looks like that:
public class SearchTab extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_search_tab);
}
}
The xml part of the project is created by importing TabHost container in design view.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context="com.example.admin.besedilatakt_v5.GlavnaStran">
<TabHost
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#android:id/tabhost">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TabWidget
android:id="#android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/tab1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
</LinearLayout>
<LinearLayout
android:id="#+id/tab2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
</LinearLayout>
<LinearLayout
android:id="#+id/tab3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
</LinearLayout>
</FrameLayout>
</LinearLayout>
</TabHost>
In the XML files of tab's activity is nothing special except TextView widget to display some random text.
Forgive my simple questions, as I'm new to android. :)
Why is the text property of the textview not displaying inside this tab?
Screen: Here
Here's my code..
MapTab2.java
package com.test.maptab2;
import android.app.TabActivity;
import android.os.Bundle;
import android.widget.TabHost;
public class MapTab2 extends TabActivity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TabHost.TabSpec spec;
spec = getTabHost().newTabSpec("tab1");
spec.setContent(R.id.mapstub);
spec.setIndicator("Map");
getTabHost().addTab(spec);
spec = getTabHost().newTabSpec("tab2");
spec.setContent(R.id.detailstub);
spec.setIndicator("Detail");
getTabHost().addTab(spec);
getTabHost().setCurrentTab(0);
}
}
Main.xml
<?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:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- Tab-switch panel -->
<TabWidget android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
<!-- Tab contents -->
<FrameLayout android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- Map here -->
<TextView android:id="#+id/mapstub"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="map"/>
<!-- Other stuff -->
<TextView android:id="#+id/detailstub"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="detail"/>
</FrameLayout>
</LinearLayout>
</TabHost>
I'm trying to build my way up to displaying a map within a tab. Best to understand the basics first, I thought. :')
I actually have had more luck setting the gravity in the parent view (in this case, your LinearLayout), then setting the layout_gravity attributes in the child views (in your case, your TextViews, etc).
To get this simple example working, I would change all your "fill_parent" attributes to "wrap_content" (or 0.0dp as another alternative) - then you can start playing with the different attributes to get everything positioned exactly how you would like.
Try adding android:gravity="center" in every TextView inside a Tab.
Hey im developing my first proper app for android and have run into 2 small hickups and was hoping for some help basicaly the main problem is that i cant seem to change to a new view from within tabhost. I have 4 tabs 2 just show a simple xml file the 3rd shows a series of pictures which i want to make clickable so that they expand out into player bio's. atm im attempting to do this in the following way but it just causes my application to crash
package com.BPRUFC;
import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TabHost;
public class BPRUFCAppActivity extends TabActivity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TabHost mTabHost = getTabHost();
mTabHost.addTab(mTabHost.newTabSpec("tab_test1").setIndicator("Fixtures").setContent(R.id.fixtures));
mTabHost.addTab(mTabHost.newTabSpec("tab_test2").setIndicator("Results").setContent(R.id.results));
mTabHost.addTab(mTabHost.newTabSpec("tab_test3").setIndicator("Players").setContent(R.id.bio));
mTabHost.addTab(mTabHost.newTabSpec("tab_test4").setIndicator("Tour").setContent(R.id.tour));
mTabHost.setCurrentTab(0);
int days = 184;
String tour2 = getString(R.string.tour, days);
}
public void clicked(View view)
{
Intent myIntent = new Intent(BPRUFCAppActivity.this, PlayerBio.class);
BPRUFCAppActivity.this.startActivity(myIntent);
}
}
main Xml stopped after first pic as its quite long
<?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:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget
android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ScrollView
android:id="#+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:id="#+id/fixtures"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="#string/fixtures" />
</ScrollView>
<TextView
android:id="#+id/results"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Results go here" />
<ScrollView
android:id="#+id/ScrollView02"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:id="#+id/bio"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView android:layout_width="90dip"
android:layout_height="90dip"
android:id="#+id/imageView1"
android:src="#drawable/forrest"
android:onClick="clicked"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp">
</ImageView>
Thanks in advance and im sure its a noob mistake
I fixed this myself. I was going about it the wrong way nesting too many layouts. I changed it all so that each tab has 1 frame layout and this is then modified accordingly it now behaves properly.
I want to load the tab3 on the load but it loads tab3 with the content of tab1. the following is the code i make for the 3 tabs to load and i want the tab3 to be loaded on 1st.
package sh.mkt;
import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;
public class thirdtab extends TabActivity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TabHost tabHost = (TabHost)findViewById(android.R.id.tabhost);
TabSpec firstTabSpec = tabHost.newTabSpec("tid1");
TabSpec secondTabSpec = tabHost.newTabSpec("tid2");
TabSpec thiredTabSpec = tabHost.newTabSpec("tid3");
firstTabSpec.setIndicator("Buying Cost").setContent(new Intent(this,tab1.class));
secondTabSpec.setIndicator("Selling Cost").setContent(new Intent(this,tab2.class));
thiredTabSpec.setIndicator("Portfolio").setContent(new Intent(this,tab3.class));
tabHost.addTab(firstTabSpec);
tabHost.addTab(secondTabSpec);
tabHost.addTab(thiredTabSpec);
tabHost.getTabWidget().setCurrentTab(2);
}
}
xml
<?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:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp">
<TabWidget
android:id="#android:id/tabs"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal"
android:layout_alignParentBottom="true"/>
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp"/>
</LinearLayout>
</TabHost>
In all three you have set "tid1" problem might be there....
You may refer to this...
for trial reason if you have kept all class same than take a look at their XML you might have forgot change its setcontentview().
PERFECT SOLUTION:
JUST USE:
tabHost.setCurrentTab(2);
instead of yours(tabHost.getTabWidget().setCurrentTab(2);)
cheeers!!!!!
you might be making a demo like this example then i doubt that you have written 3 different java file to show on each tab. Please go throught the link once.
Hello Guys and probably some Girls, is it possible to stack Layout Objects. So that one Object is over the other one?
My Problem is this, i've got a tabhost and under the tabhost i've got a tablerow with a textview in it.
I made the tabhost tabs invisible, but it hiddes my tablrow with the textview in it,how can i bring it infront?
Here is the Layout.xml
<?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"
android:weightSum="1">
<RelativeLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" />
<TabWidget
android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignBottom = "#android:id/tabcontent"
android:visibility="invisible"/>
<TableRow
android:id="#+id/ADFilterOverview"
android:layout_height="wrap_content"
android:onClick="onClickADConfig"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignTop="#android:id/tabs"
android:layout_width="match_parent">
<TextView
android:text="#string/newadfilter"
style="#style/NormalFont"
android:layout_gravity="bottom|left">
</TextView>
</TableRow>
</RelativeLayout>
</TabHost>
Thx in Advance
Best Regards
safari
Some more information, for better understanding:
Afterwards my code of my Activity looks something like this:
package de.retowaelchli.filterit;
import android.app.TabActivity;
import android.os.Bundle;
import android.widget.TabHost;
import android.content.Intent;
public class StatsActivity extends TabActivity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.stats);
TabHost tabHost = getTabHost();
tabHost.addTab(tabHost.newTabSpec("tab1").setIndicator("whatever").setContent(new Intent(this, SFilterStatsActivity.class)));
tabHost.setCurrentTab(1);
}
/** Verweise auf die anderen Seiten **/
public void onClickADConfig(View view){
final Intent i = new Intent(this, ADFilterConfigActivity.class);
startActivity(i); }
}
The linked class from my Tabhost looks for example like this:
package de.retowaelchli.filterit;
import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
public class ADFilterStatsActivity extends ListActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mListContent));
}
private static String[] mListContent={"Item 1", "Item 2", "Item 3","Item 1", "Item 2", "Item 3","Item 1", "Item 2", "Item 3","Item 1", "Item 2", "Item 3"};
}
So you see, i got a TabHost with one tab in it, which is filled from my ListActivity, the tabhost should be hidden (invisible), over this hidden tab should be the tablerow visible. So i can click it to get to my other class.
I hope this helps you guys...
FOUND A SOLUTION THX Egon
And here is the solution
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<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">
<RelativeLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" />
<TabWidget
android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignBottom = "#android:id/tabcontent"
android:visibility="invisible"/>
<TableRow android:layout_height="wrap_content" android:id="#+id/ADFilterOverview" android:layout_width="match_parent" android:onClick="onClickADConfig" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true">
<TextView android:layout_gravity="bottom|left" android:text="#string/newadfilter" style="#style/NormalFont"></TextView>
</TableRow>
</RelativeLayout>
</TabHost>
</FrameLayout>
If you want to place one View at the top of the other in Z-axis, you can use FrameLayout. It lets you position a View on the background and other views on top of it. It's really powerful and easy to use, so you must give it a try. Hope this helps.
If you make Parentview invisible then its childview also automatically make invisible. In this scenario you have to define other layout for your new tab.
If this is not correct, please make edit in, or suggest me. Thanx
EDIT: on your xml code I think tabhost is a parentview and tablerow , textview are childview of it.
I believe the problem is that you set the tabwidget to be alignParentBottom and then you set TableRow to have aligntop the tabwidget. Thus it is not visible. Making the tabwidget invisible does hide it, but the place holder is still there.