3
我有一個ScrollView
作爲父項。裏面有LinearLayout
與ImageView
和TabHost
。我通過活動更改了TabHost
的內容。在更改內容時,Tabhost
向下滾動到它自己的選項卡,標題不再可見。我怎樣才能防止這一點?滾動查看中的TabHost滾動內容更改
我的main.xml:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
android:id="@+id/mainScroll"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal" >
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="800px"
android:layout_height="fill_parent"
android:layout_gravity="center_horizontal" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="5dp" >
<ImageView
android:id="@+id/header"
android:layout_width="800px"
android:layout_height="200px"
android:src="@drawable/header" />
<TabWidget
android:id="@android:id/tabs"
android:layout_width="wrap_content"
android:layout_height="50px" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp" />
</LinearLayout>
</TabHost>
</ScrollView>
我的動態改變內容:
public class UeberActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ueber);
}
}
我怎樣才能避免這種滾動?