Reputation: 3576
I've showed terms and condition page.
The text of agreement is large, so I've added scrollview, now it scrolls vertically. That has no problems.
But I expect the design to scroll the terms text horizontally too like viewpager.
My code is,
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<RelativeLayout
android:id="@+id/RelativeLayout2"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:background="#000000" >
<TextView
android:id="@+id/Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Terms and Condition"
android:layout_centerInParent= "true"
/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/RelativeLayout3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/RelativeLayout2"
android:layout_above="@+id/RelativeLayout4"
android:background="#123456">
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollbars="horizontal"
>
<TextView
android:id="@+id/lang_list_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/terms_condition">
</TextView>
</ScrollView>
</RelativeLayout>
<RelativeLayout
android:id="@+id/RelativeLayout4"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:background="#808080"
android:layout_alignParentBottom="true">
<TextView
android:id="@+id/page_indication"
android:text="Pages:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
/>
<Button
android:id="@+id/cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
/>
<Button
android:id="@+id/done"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Agree "
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
/>
</RelativeLayout>
</RelativeLayout>
How to scroll the terms and condition text horizontally and indicate how many pages are there?
i expected design is
Upvotes: 1
Views: 1003
Reputation: 7888
Check out this will scroll when user scrolls the text only when the text ecxeeds the width of the screen
<HorizontalScrollView
android:id="@+id/ho"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/lang_list_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/terms_condition">
</TextView>
</HorizontalScrollView>
Implement this into your code.This will help you. you can add android:singleLine="true" in textview to show text in single line.
Upvotes: 1
Reputation: 7892
You can use a HorizontalScrollView instead of a normal ScrollView
. The implementation is similar
Upvotes: 2