我有一个有三个子布局的RelativeLayout。顶部布局中的客户信息(对齐父顶部),中央布局中的三个按钮以及底部布局中的横幅(对齐父级底部)。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>
你可以发布你想要的布局的图像。只是和理念,你想如何布局。 – 2012-04-07 22:28:34
明白了。我只需要最后渲染中心布局。不管怎么说,还是要谢谢你。 – user1222760 2012-04-07 23:27:39