滚动视图中的片段

gay*_*mer 5 android fragment scrollview

我需要在滚动视图中有一个 arrayAdapter(片段),下面有按钮,不幸的是,这样做时我的片段有一个元素的大小并且正在滚动自己

这是我的观点:

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

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >

        <fragment
            android:id="@+id/myfragment"
            android:name="com.myapply.MyListFragment"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="clip_vertical" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="TEST TEST TEST"
            android:textColor="#FFFFFF"
            android:textSize="25dp" />
    </LinearLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)

欢迎任何帮助

gun*_*nar 1

简短的回答是,您不能在 ScrollView 中包含 ListView。这是一个相关的 SO 线程

查看您的布局,您可以将其重新设计为relativelayout:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <fragment
            android:id="@+id/myfragment"
            android:name="com.myapply.MyListFragment"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="clip_vertical"
            android:layout_above="@+id/bottomTextView" />

        <TextView
            android:id="@+id/bottomTextView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="TEST TEST TEST"
            android:textColor="#FFFFFF"
            android:layout_alignParentBottom="true"
            android:textSize="25dp" />

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)