2015-01-25 5 views
0

텍스트에 대해서만이 레이아웃에 스크롤보기를 추가하려고 시도하지만 텍스트를 할 때마다 텍스트가 페이지의 맨 위로 이동합니다. 스크롤 뷰를 사용하여 텍스트를 페이지 맨 아래에 유지하고 싶습니다.scrollview가 작동하지 않음을 추가합니다.

도움이 필요하십니까?

활동

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

    <ImageView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/imageView" 
     android:layout_gravity="center_horizontal" 
     android:layout_alignParentTop="true" 
     android:layout_centerHorizontal="true" 
     android:layout_marginTop="120dp" /> 

    <TextView android:id="@+id/text" 
     android:layout_width="match_parent" android:layout_height="wrap_content" 
     android:gravity="center_vertical|center_horizontal" 
     android:textAppearance="?android:attr/textAppearanceMedium" 
     android:text="@string/hello_world" 
     android:textColor="@android:color/black" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true" 
     android:padding="20dp" 
     android:layout_marginBottom="30dp" 
     android:textIsSelectable="false" 
     android:textSize="14sp" /> 


</RelativeLayout> 
+0

선형 레이아웃을 시도 –

답변

0

RelativeLayout를 사용합니다. 아래쪽의 TextView으로 시작하여 ScrollView을 TextView 위에 놓습니다.

<LinearLayout android:id="@+id/ll1" 
    android:layout_alignParentTop="true" 
    (...)/> 

<TextView android:id="@+id/text" 
    android:layout_alignParentBottom="true" 
    (...)/> 

<ScrollView 
    android:layout_above="@id/button" 
    android:layout_below="@id/ll1" 
    (...)/> 

관련 문제