[英]How can I make one of my textViews scrollable in my viewpager?
My ViewPager is working, but I can't get the textView to scroll when the text is too long for the page. 我的ViewPager工作正常,但是当文本对于页面来说太长时,我无法使textView滚动。 Here is my xml for the layout of each page.
这是我每个页面布局的xml。 I would like the top TextView to stay fixed, while the bottom TextView scrolled if it was too long for the page.
我希望顶部的TextView保持固定,而底部的TextView如果页面太长则滚动。 Any help is appreciated.
任何帮助表示赞赏。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp" >
<TextView
android:id="@+id/reference"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#128238"
android:textStyle="bold"
android:textSize="24dp"/>
<TextView
android:id="@+id/details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#128238"
android:textSize="24dp"
android:layout_below="@+id/reference"
android:scrollbars="vertical" />
You can wrap your TextView
with ScrollView
like 您可以使用
ScrollView
包裹TextView
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" >
android:id="@+id/content_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/device_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="device info" />
</ScrollView>
</RelativeLayout>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.