在我的xml文件中,我有一個linearLayout和一個按鈕。 linearLayout包含很多textViews和複選框。所以我想這些textViews和複選框滾動,但按鈕應該保留在它的地方,即它不應該與textViews滾動。爲此,我用這樣的scrollView覆蓋我的linearLayout在LinearLayout中使用ScrollView,Android
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/homeo11" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/nexttodetail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="10dp">
</LinearLayout>
</ScrollView>>
<Button android:id="@+id/Next4"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Next" />
</LinearLayout>
但是,這樣做,隱藏我的按鈕。意味着textviews和複選框現在滾動正確,但我看不到我的下一個按鈕。我嘗試將scrollView佈局替換爲:從fill_parent到wrap_content的高度,但這不起作用。任何幫助?
使用'機器人:layout_weight =「1」'在滾動條和按鈕 – Shvet 2014-11-02 07:15:35
如果改爲用戶'RelativeLayout'作爲最外層的佈局,你可以在按鈕內部使用'android:layout_alignParentBottom =「true」'將它保持在Bottom並始終可見。 – 2014-11-02 07:22:14