你好,可能還有一些女孩,是否可以堆疊佈局對象。那麼一個對象是另一個呢? 我的問題是這樣的,我有一個tabhost,在tabhost下我有一個帶有textview的tablerow。如何將不同的佈局對象堆疊在一起?
我使tabhost選項卡不可見,但它隱藏我的tablrow與textview中,我怎麼能把它帶來盈方?
這裏是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提前
問候 野生動物園
一些更多的信息,以便更好地理解:
後來我我的活動代碼看起來像這樣:
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); }
}
從我Tabhost鏈接的類看起來例如像這樣:
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"};
}
所以你看,我買了它一個標籤,這是從我的ListActivity填補了TabHost,該tabhost應該被隱藏(不可見的),在這個隱藏的標籤上應該是可見的表格。所以我可以點擊它來到我的其他班。 我希望這可以幫助你們......
找到了解決辦法THX Egon
這裏是解決
<?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>
爲什麼你讓你的TabHost隱形? – user370305
我只有一個Tab,它是全部激活的,並且充滿了從數據庫填充的ListActivity中的內容。我需要Tablerow才能進入下一個活動,在那裏我可以爲我的數據庫設置內容,然後在此Tabhost中展示=)我希望你明白 – safari
,因爲你總是在選項卡上,爲什麼使用TabHost? –