Android 水平滚动视图不填充父视图

Android 水平滚动视图不填充父视图,android,layout,android-scrollview,horizontalscrollview,Android,Layout,Android Scrollview,Horizontalscrollview,我想在垂直和水平方向上滚动我的文本视图文本,但水平滚动条正好出现在最后一行的底部,相反,我想在滚动视图的底部显示这个 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_par

我想在垂直和水平方向上滚动我的文本视图文本,但水平滚动条正好出现在最后一行的底部,相反,我想在滚动视图的底部显示这个

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#D7D1CA"
android:orientation="vertical"
tools:context="com.example.hortiplus.PracticeExamActivity" >

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_marginLeft="5dp"
    android:layout_marginRight="5dp"
    android:layout_marginTop="5dp"
    android:layout_weight="1"
    android:background="@drawable/edittext_background"
    android:gravity="top"
    android:paddingBottom="15dp" >

    <HorizontalScrollView
        android:layout_width="wrap_content"
        android:layout_height="fill_parent" >

        <TextView
            android:id="@+id/txtQuestion"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:fontFamily="sans"
            android:padding="8dp"
            android:text="This is layout  This is sample text This is sample text "
            android:textSize="18sp" />
    </HorizontalScrollView>
  </ScrollView>
  <-- Some other Linear Layout goes here   -->
</LinearLayout>

试试这个:

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

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        android:layout_marginTop="5dp"
        android:layout_weight="1"
        android:gravity="top"
        android:paddingBottom="15dp">


        <TextView
            android:id="@+id/txtQuestion"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:fontFamily="sans"
            android:padding="8dp"
            android:text="This is layout  Thefwef fwf jkne fwnfiw wofjwoifj is is sample text This is sample text "
            android:textSize="18sp" />
    </ScrollView>
</HorizontalScrollView>


我交换了ScrollView和HorizontalScrollView,当父项被折旧时,填充。请改用
match_parent
,看看这是否解决了您的问题