2012-06-18 6 views
0

다음은 앱의 레이아웃입니다. viewflipper 아래에 두 개의보기가 있습니다. 두 번째보기에는 3 개의 행이 있고 1 행에는 3 개의 버튼이 있으며 2 행에는 이미지가 있고 3 행에는 3 개의 버튼이 있습니다. 행 1을 화면의 맨 위에 맞추고 행 3을 화면의 아래쪽에 맞추고 이미지를 나머지 공간을 사이에두고 싶습니다. 아무도 그걸 어떻게 달성 할 수 있는지 말해 줄 수 없습니까?올바른 레이아웃을 얻을 수 없습니다.

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout android:id="@+id/LinearLayout01" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical"> 

<ViewFlipper android:id="@+id/ViewFlipper01" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <!--adding views to ViewFlipper--> 
     <!--view=1--> 
    <LinearLayout 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 

    <TextView 
    android:id="@+id/tv1" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello" 
    > 
    </TextView> 

<VideoView 
android:id="@+id/myvideoview" 
android:layout_width="wrap_content" 
android:layout_height="match_parent" /> 

<Button 
android:id="@+id/b" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:text="Button" /> 

    </LinearLayout> 

     <!--view=2--> 

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

    <!--row 1--> 
     <RelativeLayout 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:layout_alignParentTop="true" 
xmlns:android="http://schemas.android.com/apk/res/android" 
> 

    <Button 
    android:id="@+id/button1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:text="Back" /> 
    <Button 
    android:id="@+id/button3" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentRight="true" 
    android:text="Upload to Facebook" /> 
    <Button 
    android:id="@+id/button2" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_toLeftOf="@id/button3" 
    android:text="Save" /> 

    </RelativeLayout> 

     <!--row 2--> 
    <RelativeLayout 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" > 
    <ImageView 
    android:id="@+id/img" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" /> 
    </RelativeLayout> 


    <!--row 3--> 
    <RelativeLayout 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
> 
    <Button 
    android:id="@+id/button4" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Previous" /> 
    <Spinner 
    android:id="@+id/spinner" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_toRightOf="@id/button4"> 
</Spinner> 
<Button 
    android:id="@+id/button5" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_toRightOf="@id/spinner" 
    android:text="Next" /> 
</RelativeLayout> 



    </LinearLayout> 

</ViewFlipper> 

</LinearLayout> 

답변

0

보기에는 RelativeLayout을 사용하십시오.

그러면 첫 번째 행에 android:layout_alignParentTop="true"를 사용하여 세 번째 행에 치수 fill_parent 중간 함께 사용 android:layout_below="@id/first_row" android:layout_above="@id/third_row"의 이미지에서 마지막 android:layout_alignParentBottom="true"

를 사용한다.

관련 문제