我想垂直和水平滚动我的文本视图文本,它可以工作,但水平滚动条恰好出现在最后一行的底部,而我想在滚动视图底部
<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>
答案 0 :(得分:0)
试试这个:
<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
答案 1 :(得分:0)
fill_parent
已弃用。请改用match_parent
,看看是否能解决您的问题。