2011-01-03 4 views
1

私はそれはむしろ単純な質問だと思うが、私はそれが欲しい方法ではない。 私は3つの領域を持つAndroidで線形レイアウトをしたいですか?Androidリニアレイアウトsteching

トップ領域の高さは、fill_parentでなければなりません。 2番目のものは、最初のものよりも、使用可能なすべての部屋、fill_parentの幅を使用する必要があります。 2番目の下の3番目のものは、固定高さfill_parentの幅を持つ必要があります。ここで

は、私が得たものである:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" 
    android:gravity="bottom" 
    android:background="#ff63a920"> 
    <LinearLayout 
android:id="@+id/top_bar" 
android:layout_width="fill_parent" 
android:layout_height="32dp" 
> 
</LinearLayout> 
    <com.google.android.maps.MapView android:id="@+id/mymapView" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:enabled="true" 
     android:clickable="true" 


     /> 
<LinearLayout 
android:id="@+id/bottombar" 
android:layout_width="fill_parent" 
android:layout_height="32dp" 
> 
</LinearLayout> 
</LinearLayout> 

問題があり、中央のIST大きすぎるでのMapView、それはtopbarを押し出すように。

私はあなたが私を助けることを願っています。トリックをしたものだセバスチャン

+0

トップレベルのコンテナをRelativeLayoutにする方が良い方法でしょうか。 – EboMike

+1

'layout_weight'設定を試しましたか? –

+0

私はそれがシンプルだと言った:topのためのlayout_weight = 0とmapviewのための= 1はそれをした。 – Maffo

答えて

1

ありがとう:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" 
    android:gravity="bottom" 
    android:background="#ff63a920"> 
    <LinearLayout 
android:id="@+id/top_bar" 
android:layout_width="fill_parent" 
android:layout_height="32dp" 
android:layout_weight="0" 
> 
</LinearLayout> 
    <com.google.android.maps.MapView android:id="@+id/mymapView" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:enabled="true" 
     android:clickable="true" 
     android:layout_weight="1" 

     /> 
<LinearLayout 
android:id="@+id/bottombar" 
android:layout_width="fill_parent" 
android:layout_height="32dp" 
android:layout_weight="0" 
> 
</LinearLayout> 
</LinearLayout> 
0

DroidDrawと呼ばれるソフトウェアがあります。 (フリーウェア)それを使用すると、あなたのためにXMLコードが自動的に生成されます。

助けてくれること

関連する問題