2013-03-07 2 views
0

TextView, ImageViewButton을 포함하는 레이아웃을 정의했습니다.모든 콘텐츠의 Android보기에서 크기를 올바르게 정의하는 방법은 무엇입니까?

xml 파일에서 LinearLayout을 사용하여 이러한 뷰를 포함하려고했습니다. 그게 제대로 작동 (내 TextViewImageViewButton 볼 수 있지만 때로는 TextView 너무 길어 내 ImageView 및 내 Button 볼 수 없습니다.

RelativeLayout을 시도했지만 의도 한 결과가 나오지 않았습니다.

<?xml version="1.0" encoding="utf-8"?> 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="@drawable/splash" > 

    <TextView 
     android:id="@+id/storybox" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:autoLink="all" 
     android:layout_marginLeft="10dp" 
     android:layout_marginRight="10dp" 
     android:text="Texte" 
     android:textAlignment="center" 
     android:textColor="#FFFFFF" 
     android:textSize="20px" /> 

    <ImageView 
     android:id="@+id/ivImage" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" /> 

    <Button android:id="@+id/image" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Images" 
     android:onClick="onButtonDownUpActivityClick" /> 

</LinearLayout> 

답변

1

간단히 LinearLayoutScrollView A의 포장.

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 

    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:background="@drawable/splash" > 
... 
.... 
.... 
... 

    </LinearLayout> 
</ScrollView> 
+0

는 완벽. 감사합니다 :))) –

1

당신은 화면에 너무 큰 항목을 보관하는 데 의미 레이아웃 요소 ScrollView을 찾고 될 수 있습니다. ScrollView에는 자식이 하나만 있어야하며 (RelativeLayout) 그 자식은 더 복잡한 레이아웃을 포함합니다.

체크 아웃 이상 안드로이드 개발자 가이드 : http://developer.android.com/reference/android/widget/ScrollView.html

관련 문제