2014-05-14 89 views
0

我有一个RelativeLayout与其他几个孩子(其他布局,图像和按钮)。使RelativeLayout完全填充屏幕

所有内部布局/视图都适应相关的RelativeLayout。我可以让这个RelativeLayout完全填满屏幕吗?

编辑:我的布局:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/container" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:gravity="center_vertical|center_horizontal" 
    android:layout_gravity="center_vertical" > 

<ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" > 

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

<RelativeLayout 
    android:id="@+id/start_activity_relLayout_container" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_above="@+id/start_activity_relLayout_container_bottom" 
    android:gravity="center_horizontal" 
    android:layout_gravity="center_vertical" > 

<RelativeLayout 
    android:id="@+id/relLayout_dialogfragment_image" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/linLayout_imageview_container" 
    android:gravity="center_vertical" > 

    <ImageView 
     android:id="@+id/image" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/tutorial_thirdview" 
     android:text="@string/button_servicerequirement" /> 

</RelativeLayout> 
</RelativeLayout> 

    <RelativeLayout 
    android:id="@+id/start_activity_relLayout_container_bottom" 
    android:layout_width="match_parent" 
    android:layout_height="30dp" 
    android:layout_marginTop="@dimen/two"> 

    <LinearLayout 
    android:id="@+id/linearLayout1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_centerHorizontal="true"> 

    <Button 
     android:id="@+id/image_cancel" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="@string/button_cancel" 
     style="@style/button_standard_bright_smaller" 
     android:layout_marginRight="3dp"/> 
    <Button 
     android:id="@+id/image_ok" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="@string/button_ok" 
     android:layout_marginLeft="3dp"/> 
     </LinearLayout> 
    </RelativeLayout> 
    </LinearLayout> 
</ScrollView> 
</RelativeLayout> 

编辑2: 我设置imageview的动态BTW。

+0

在这里显示你的xml文件 – Piyush

+0

@PiYusH GuPtA我只是做了:) – deimos1988

+0

根据你的xml,父亲'RelativeLayout'确实填满整个屏幕。 – Leandros

回答

0

您是否尝试过在您的xml布局文件中将RelativeLayout的layoutWidthlayoutHeight属性设置为match_parent

+0

是的,不幸的是,这并没有帮助。我也有一个ScrollView作为RelativeLayout中的下一个孩子 - 这可能是问题吗? – deimos1988

+0

你可以发布你的XML布局吗? –

+0

我刚加了:) – deimos1988