小编kak*_*o76的帖子

Android:垂直LinearLayout中的ScrollView

我正在为Android设备制作一个应用程序,我正在尝试在LinearLayout中使用ScrollView,但是当我尝试这样做时,ScrollView会占用LinearLayout中ScrollView之后的所有空间和元素.

例如:
如果ScrollView不是"完整":
http://kakko76.free.fr/scroll2.jpg
如果ScrollView是"完整":
http://kakko76.free.fr/scroll1.png

正如您所看到的,按钮消失...
以下是此活动的代码:

<LinearLayout
    android:id="@+id/linearLayout1"
    android:layout_width="fill_parent"
    android:layout_marginLeft="50dp"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:orientation="vertical"
    android:focusable="true"
    android:focusableInTouchMode="true"
    android:background="@drawable/linearlayoutbackground" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/nom_des_joueurs"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:layout_marginBottom="30dp" />

    <ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <LinearLayout
            android:id="@+id/llPlayersName"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
             >

        </LinearLayout>

    </ScrollView>

    <Button
        android:id="@+id/okPlayersName"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="@string/ok"
        android:background="@drawable/backgroundbutton"
        android:layout_marginTop="30dp" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

在LinearLayout中添加ScrollView中的元素之后.
有解决方案吗
谢谢.

android android-layout android-linearlayout

6
推荐指数
1
解决办法
4万
查看次数