Search code examples
androidtextviewandroid-scrollview

Why i cant scroll in textview android?


I'm beginner in android and i write simple apllication to show a simple text in textView in android studio,but when i write a big text in textView,textview can't scroll,my xml file is:

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout"
    android:layout_width="match_parent" android:layout_height="match_parent"
    tools:context=".MainActivity">
    <FrameLayout android:id="@+id/container" android:layout_width="match_parent"
            android:layout_height="match_parent" >
    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="Large Text"
            android:id="@+id/MAINLABEL"
            android:layout_gravity="center" />
        </FrameLayout>
</android.support.v4.widget.DrawerLayout>


what happen?


Solution

  • <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        >
    
    <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceLarge"
                android:text="Large Text"
                android:id="@+id/MAINLABEL"
                android:layout_gravity="center" />
    
    </ScrollView>