2012-04-07 18 views
0

3つの子レイアウトを持つRelativeLayoutがあります。一番上のレイアウト(親の上に揃える)、中央のレイアウトに3つのボタン、下のレイアウトにバナー(親の一番下に揃える)の顧客情報Androidレイアウト - 位置レイアウト

ボトムバナーを適切にボトムに合わせるために、ボトムアップから塗りつぶしています。

センターレイアウトが正しく表示されない問題があります。私の一番上のレイアウトは中央のレイアウトを強制的に押し下げています。中央のボタンのうちの1つまたは2つを無効にすると、レイアウトの上部に重力を浮かべる必要があります。私は適切に表示する必要があるもののバリエーションを得ることができますが、すべてが正しく配置されているわけではありません。

ご協力いただければ幸いです。ありがとう

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/adLayout" 
    android:background="@drawable/ad_contact_background" 
    android:layout_height="fill_parent" 
    android:layout_width="match_parent" 
    android:orientation="horizontal" > 

    <LinearLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/linearLayoutAd" 
     android:layout_height="wrap_content" 
     android:layout_width="match_parent" 
     android:layout_alignParentBottom="true" > 

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

    </LinearLayout> 

    <RelativeLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/relativeLayoutContact" 
     android:layout_height="wrap_content" 
     android:layout_width="match_parent" 
     android:layout_above="@+id/linearLayoutAd" > 

     <Button 
      android:id="@+id/ad_contactWebsiteButton" 
      android:background="@drawable/button_black" 
      android:layout_height="50dp" 
      android:layout_width="match_parent" 
      android:layout_marginTop="10dip" 
      android:layout_marginLeft="20dip" 
      android:layout_marginRight="20dip" 
      android:textSize="18dip" 
      android:textStyle="bold" 
      android:textColor="@android:color/white" 
      android:typeface="sans" /> 

     <Button 
      android:id="@+id/ad_contactEmailButton" 
      android:background="@drawable/button_black" 
      android:layout_height="50dp" 
      android:layout_width="match_parent" 
      android:layout_marginTop="10dip" 
      android:layout_marginLeft="20dip" 
      android:layout_marginRight="20dip" 
      android:textSize="18dip" 
      android:textStyle="bold" 
      android:textColor="@android:color/white" 
      android:typeface="sans" /> 

     <Button 
      android:id="@+id/ad_contactPhoneButton" 
      android:background="@drawable/button_black" 
      android:layout_height="50dp" 
      android:layout_width="match_parent" 
      android:layout_marginTop="10dip" 
      android:layout_marginLeft="20dip" 
      android:layout_marginRight="20dip" 
      android:layout_marginBottom="20dip" 
      android:textSize="18dip" 
      android:textStyle="bold" 
      android:textColor="@android:color/white" 
      android:typeface="sans" /> 

    </RelativeLayout> 

    <LinearLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/linearLayoutTitle" 
     android:layout_height="wrap_content" 
     android:layout_width="match_parent" 
     android:layout_above="@+id/relativeLayoutContact" 
     android:layout_alignParentTop="true" > 

     <TextView 
      android:id="@+id/ad_contactTitleTextView" 
      android:cacheColorHint="#00000000" 
      android:gravity="center" 
      android:layout_height="wrap_content" 
      android:layout_width="match_parent" 
      android:layout_marginLeft="10dip" 
      android:layout_marginRight="10dip" 
      android:layout_marginTop="20dip" 
      android:textColor="#000000" 
      android:textSize="24dip" 
      android:textStyle="bold" 
      android:typeface="sans" /> 

     <TextView 
      android:id="@+id/ad_contactAddressTextView" 
      android:cacheColorHint="#00000000" 
      android:gravity="center" 
      android:layout_height="wrap_content" 
      android:layout_width="match_parent" 
      android:layout_marginLeft="10dip" 
      android:layout_marginRight="10dip" 
      android:textColor="#000000" 
      android:textSize="20dip" 
      android:typeface="sans" /> 

    </LinearLayout> 

</RelativeLayout> 
+1

あなたの希望のレイアウトの画像を投稿できますか?あなたとあなたのレイアウトをどのようにしたいのですか? –

+0

入手しました。私はちょうどセンターレイアウトを最後にする必要がありました。とにかくありがとう。 – user1222760

答えて

0

これが表示されます。私はちょうどセンターレイアウトを最後にする必要がありました。

ありがとうございました

0

下記の修正されたxmlファイルを使用してください。

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/adLayout" 
    android:layout_width="match_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 
    <LinearLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/linearLayoutTitle" 
     android:layout_height="wrap_content" 
     android:layout_width="match_parent" 
     android:layout_alignParentTop="true"> 

     <TextView 
      android:id="@+id/ad_contactTitleTextView" 
      android:cacheColorHint="#00000000" 
      android:gravity="center" 
      android:layout_height="wrap_content" 
      android:layout_width="wrap_content" 
      android:layout_marginLeft="10dip" 
      android:layout_marginRight="10dip" 
      android:layout_marginTop="20dip" 
      android:textColor="#000000" 
      android:textSize="24dip" 
      android:textStyle="bold" 
      android:typeface="sans" /> 

     <TextView 
      android:id="@+id/ad_contactAddressTextView" 
      android:cacheColorHint="#00000000" 
      android:gravity="center" 
      android:layout_height="wrap_content" 
      android:layout_width="wrap_content" 
      android:layout_marginLeft="10dip" 
      android:layout_marginRight="10dip" 
      android:textColor="#000000" 
      android:textSize="20dip" 
      android:typeface="sans" /> 

    </LinearLayout> 



    <LinearLayout 
     android:id="@+id/relativeLayoutContact" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/linearLayoutTitle" 
     android:orientation="horizontal" > 

     <Button 
      android:id="@+id/ad_contactWebsiteButton" 
      android:background="@drawable/ic_launcher" 
      android:layout_height="50dp" 
      android:layout_width="wrap_content" 
      android:layout_marginTop="10dip" 
      android:layout_marginLeft="20dip" 
      android:layout_marginRight="20dip" 
      android:textSize="18dip" 
      android:textStyle="bold" 
      android:textColor="@android:color/white" 
      android:typeface="sans" /> 

     <Button 
      android:id="@+id/ad_contactEmailButton" 
      android:background="@drawable/ic_launcher" 
      android:layout_height="50dp" 
      android:layout_width="wrap_content" 
      android:layout_marginTop="10dip" 
      android:layout_marginLeft="20dip" 
      android:layout_marginRight="20dip" 
      android:textSize="18dip" 
      android:textStyle="bold" 
      android:textColor="@android:color/white" 
      android:typeface="sans" /> 

     <Button 
      android:id="@+id/ad_contactPhoneButton" 
      android:background="@drawable/ic_launcher" 
      android:layout_height="50dp" 
      android:layout_width="wrap_content" 
      android:layout_marginTop="10dip" 
      android:layout_marginLeft="20dip" 
      android:layout_marginRight="20dip" 
      android:layout_marginBottom="20dip" 
      android:textSize="18dip" 
      android:textStyle="bold" 
      android:textColor="@android:color/white" 
      android:typeface="sans" /> 

    </LinearLayout> 

    <ImageView 
     android:id="@+android:id/ad_contactAdImageView" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:src="@drawable/ic_launcher" 
     android:layout_alignParentBottom="true"/> 
</RelativeLayout>