Android如何將RelativeLayout對齊到底部?
我可以告訴你在佈局上面的prnt屏幕,我實際上有我的xml和我假裝有的佈局。我在相對佈局設置中做了一些更改,但無法解決它。
下面是代碼:
@佈局/ gridview.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/BackGroundColor"
android:orientation="vertical"
android:scaleType="center" >
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginBottom="0dp"
android:layout_marginLeft="0dip"
android:layout_marginRight="0dip"
android:background="@color/BlueOcean" />
<GridView
android:id="@+id/grid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="4dp"
android:columnWidth="100dp"
android:horizontalSpacing="5dip"
android:listSelector="@layout/gridview_selector"
android:numColumns="3"
android:padding="1dp"
android:scaleType="fitCenter"
android:stretchMode="columnWidth"
android:verticalSpacing="4dp" />
<RelativeLayout
android:id="@+id/overviewBottomBar"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_gravity="bottom"
android:gravity="top"
android:background="@layout/overviewbottombar_selector"
android:textSize="14sp">
<TextView
android:id="@+id/overviewScreenLeft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="39dp"
android:text="Left"
android:textColor="@color/holo_blue_dark" />
<View
android:id="@+id/overviewBottomBarDividerLeft"
android:layout_width="1dp"
android:layout_height="32dp"
android:layout_centerVertical="true"
android:layout_marginLeft="39dp"
android:layout_toRightOf="@+id/overviewScreenLeft"
android:background="@color/darker_gray" />
<TextView
android:id="@+id/overviewScreenCenter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/overviewScreenLeft"
android:layout_alignBottom="@+id/overviewScreenLeft"
android:layout_centerHorizontal="true"
android:text="Center"
android:textColor="@color/holo_blue_dark" />
<View
android:id="@+id/overviewBottomBarDividerRight"
android:layout_width="1dp"
android:layout_height="32dp"
android:layout_centerVertical="true"
android:layout_marginLeft="38dp"
android:layout_toRightOf="@+id/overviewScreenCenter"
android:background="@color/darker_gray" />
<TextView
android:id="@+id/overviewScreenRight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/overviewScreenCenter"
android:layout_alignBottom="@+id/overviewScreenCenter"
android:layout_alignParentRight="true"
android:layout_marginRight="39dp"
android:text="Right"
android:textColor="@color/holo_blue_dark" />
</RelativeLayout>
</LinearLayout>
哪些錯誤呢?
感謝
這可能是重複的:http://stackoverflow.com/問題/ 2386866/how-to-align-views-the-the-bottom-of-the-screen看看是否有幫助。 – Qberticus