0

I added ScrollView like this:

<ScrollView
  android:layout_width="fill_parent"
  android:layout_height="200dp" >     
  <TextView
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:gravity="center"
      android:text="- A Learning"
      android:textColor="#ffffff"
      android:textSize="20sp"
      android:textStyle="italic" />
  <TextView
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:gravity="center"
      android:text="- B Learning"
      android:textColor="#ffffff"
      android:textSize="20sp"
      android:textStyle="italic" />

There is < / ScrollView > up

And gave me this at the Graphical Layout: Exception raised during rendering: ScrollView can host only one direct child, Exception details are logged in Window > Show View > Error Log

TaWe
  • 1
  • 3

2 Answers2

2

Put both TextView inside LinearLayout. ScrollView can have only one child. You are giving two here.

<ScrollView
   android:layout_width="fill_parent"
   android:layout_height="200dp" >   
   <LinearLayout  
    android:layout_width="match-parent"
    android:layout_height="match-parent">
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:gravity="center"
        android:text="- A Learning"
        android:textColor="#ffffff"
        android:textSize="20sp"
        android:textStyle="italic" />
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:gravity="center"
        android:text="- B Learning"
        android:textColor="#ffffff"
        android:textSize="20sp"
        android:textStyle="italic" />
   </LinearLayout>
</ScrollView>
Green goblin
  • 9,898
  • 13
  • 71
  • 100
0

You should put the ScrollView for a Layout, i.e RelativeLayout, LinearLayout etc... So simply have the two TextViews inside such a Layout and put this layout inside the ScrollView. Then, as it wants, ScrollView will have only one direct child.

Kartik_Koro
  • 1,277
  • 1
  • 11
  • 23