2014-02-28 4 views
0

나는 동일한 활동으로 ImageViewTextView을 가진 Android 활동을 운영하고 있습니다. 그러나 텍스트의 길이가 화면을 초과하므로 상단에있는 이미지를 스크롤하지 않고 스크롤 할 수 있기를 바랍니다.ScrollView 및 TextView 사용

이것은 내가 시도했지만 내가 원하는 효과를 얻을 수 없었습니다.

<ImageView 
    android:id="@+id/imageView1" 
    android:layout_width="260dp" 
    android:layout_height="210dp" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentRight="true" 
    android:layout_alignParentTop="true" 
    android:layout_marginBottom="0dp" 
    android:layout_marginEnd="0dp" 
    android:layout_marginRight="0dp" 
    android:layout_marginStart="0dp" 
    android:layout_marginTop="0dp" 
    android:src="@drawable/xdr" /> 

<ScrollView> 
    <TextView 
    android:id="@+id/textView1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignLeft="@+id/imageView1" 
    android:layout_alignParentBottom="true" 
    android:text="@string/xdr" /> 
</ScrollView> 

내 생각 그대로 ScrollView 외부 이미지를 떠나있는 동안 ScrollViewTextView 퍼팅 텍스트 스크롤을 할 수 있다고했지만 내가 틀렸다 보인다.

내가 원하는 효과를 얻으려면 어떻게해야합니까? XML 아래

+0

사용 무게는 –

+0

내가이 하나,뿐만 아니라 컴파일되지 않습니다, 전체 레이아웃을 게시 할 것을 제안 할 수 속성뿐만 아니라 중요한 속성이 부족하다. – njzk2

답변

0

사용

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

    <ImageView 
      android:id="@+id/imageView1" 
      android:layout_width="260dp" 
      android:layout_height="210dp" 
      android:layout_alignParentLeft="true" 
      android:layout_alignParentRight="true" 
      android:layout_alignParentTop="true" 
      android:layout_marginBottom="0dp" 
      android:layout_marginEnd="0dp" 
      android:layout_marginRight="0dp" 
      android:layout_marginStart="0dp" 
      android:layout_marginTop="0dp" 
      android:src="@drawable/xdr" /> 

    <ScrollView 
     android:id="@+id/scrollView1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/imageView1" > 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical" > 

     <TextView 
      android:id="@+id/textView1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="@string/xdr" /> 


    </LinearLayout> 

    </ScrollView> 

</RelativeLayout> 
+0

이 (가) 박히 셨습니다. ;) ..) .. – user3237883

0

나는 scrollviews 속성을 변경했습니다. 이 XML을 사용

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 

    <ImageView 
     android:id="@+id/imageView1" 
     android:layout_width="260dp" 
     android:layout_height="210dp" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentTop="true" 
     android:layout_marginBottom="0dp" 
     android:layout_marginEnd="0dp" 
     android:layout_marginRight="0dp" 
     android:layout_marginStart="0dp" 
     android:layout_marginTop="0dp" 
     android:src="@drawable/xdr" /> 

    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/imageView1" 
     android:layout_alignParentBottom="true" > 

     <TextView 
      android:id="@+id/textView1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="@string/xdr" 
      ></TextView> 
    </ScrollView> 

</RelativeLayout> 
관련 문제