Android: How to make current layout with scrollable text view?

Read Time:50 Second

Original Article: http://stackoverflow.com/questions/2621776/android-how-to-make-current-layout-with-scrollable-text-view

--------------------
|btn1|  txt1  |btn2|
--------------------
|                  |
|                  |
|                  |
|     txtview1     |
|                  |
|                  |
|                  |
--------------------

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <Button
        android:id="@+id/btn1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="btn1"/>

    <TextView
        android:id="@+id/txt1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:text="txt1"/>

    <Button
        android:id="@+id/btn2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:text="btn2"/>

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_below="@id/btn1">

        <TextView
            android:id="@+id/txt2"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="txt2"/>

    </ScrollView>

</RelativeLayout>

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.