2013-04-07 37 views

回答

1

,如果你使用的是相對佈局...

如果你有,你可以做這樣的事情

填充整個屏幕的相對佈局,您應該可以使用android:layout_alignParentBottom將視圖移動到屏幕的底部。

然後將layout_marginleft設置爲您想要的值以將其設置爲中心

0

看看是什麼在尋找:

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


    <LinearLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentRight="true" 
     android:gravity="center" 
     android:orientation="vertical" > 

     <Button 
      android:id="@+id/button1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Button" /> 
    </LinearLayout> 

</RelativeLayout> 
相關問題