2011-09-09 9 views
0

RelativeLayoutを使用して、使用可能なすべての領域(いくつかのビューを動的に塗りつぶす必要があります)と画面の下端にあるボタンを使用することが可能ですか?android RelativeLayout

私は次しようとしたが、無努力で:このソリューションwhith

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

<FrameLayout 
    android:id="@+id/topFrame" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentTop="true" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentRight="true" 
    android:layout_margin="6dp"> 

    <TextView 
     android:text="blabla" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" /> 

</FrameLayout> 

<Button android:id="@+id/button1" 
    android:text="Button 1" 
    android:layout_height="wrap_content" 
    android:layout_width="fill_parent" 
    android:layout_below="@id/topFrame" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentRight="true" 
    android:layout_margin="6dp" /> 

<Button android:id="@+id/button2" 
    android:text="Button 2" 
    android:layout_height="wrap_content" 
    android:layout_width="fill_parent" 
    android:layout_below="@id/button1" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentRight="true" 
    android:layout_margin="6dp" /> 

ボタンはスペースやないでframeLayoutを埋めます。

答えて

0

試してみてください。この:でframeLayoutで

<RelativeLayout......> 
<FrameLayout 
android:id="@+id/topFrame" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:layout_alignParentTop="true" 
android:layout_alignParentLeft="true" 
android:layout_alignParentRight="true" 
android:layout_margin="6dp"> 

<TextView 
    android:text="blabla" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" /> 

</FrameLayout> 
<RelativeLayout 
    android:id="@+id/InnerRelativeLayout" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" > 

    <Button 
     ..... 
    </Button> 

    <Button 
     ..... 
    </Button> 

</RelativeLayout> 
</RelativeLayout> 
0

、その後、android:layout_above="@+id/button1"が含まandroid:layout_height="wrap_content"android:layout_height="fill_parent"に変更。 FrameLayoutが強制的にスペースを埋めるように強制し、常に最初のボタンの上に置く必要があります。

0

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


<Button android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:id="@+id/button1" 
android:text="Button" 
android:layout_alignParentBottom="true" 
android:layout_alignParentRight="true" 
android:layout_alignParentLeft="true"/> 

<Button android:layout_height="wrap_content" 
android:id="@+id/button2" 
android:text="Button" 
android:layout_above="@+id/button1" 
android:layout_width="fill_parent" 
android:layout_alignParentLeft="true"/> 

<FrameLayout android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:id="@+id/frameLayout1" 
android:layout_above="@+id/button2" 
android:layout_alignParentTop="true" 
android:layout_alignParentRight="true" 
android:layout_alignParentLeft="true"> 

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


</FrameLayout> 

</RelativeLayout> 

申し訳ありませんが、私は何かを逃した場合。

関連する問題