2011-01-24 10 views
1

Hy !!ビューの下にボタンを描く

ボタンにボタンを配置し、線形レイアウトのビューの中央に配置したいと考えています。

非作業例:

<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom" android:id="@+id/login_btnew" android:text="Make a new Account"></Button> 

ソリューション?

私はあなたが私はビューをスクロールしていると下部に、私は番目のボタンを持っている上に述べた線形レイアウトを持っている:

おかげ

答えて

2

あなたがlayout_weightおよびレイアウト機能のための別のLinearLayoutに置くと仕事をしなければならないRelativeLayout

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_height="fill_parent" 
    android:layout_width="fill_parent"> 


<Button android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_centerHorizontal="true" 
    android:id="@+id/login_btnew" 
    android:text="Make a new Account"></Button> 

</RelativeLayout> 
0

は、私には、例えば、以下の方法であることでした。スクロールビューの場合はアンドロイド:layout_weight = "1000"を使用し、ボタンの場合はアンドロイド:layout_weight = "1"を使用して目的の結果を得ます。 android:layout_gravity = "center_horizo​​ntal"を使用してボタンを中央に配置

0

使用この

<Button android:id="@+id/login_btnew" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" android:text="Make a new Account" 
android:layout_gravity="bottom"/> 
0

次のことを試してみたいことがあります。

あなたは(擬似コード)のようなSTHを行うことができ

<linearlayout layout_height=fill_parent layout_with=fill_parent> 
    #the "top" fields 
    <linearlayout layout_height=fill_parent layout_with=fill_parent layout_weight=1> 
     <elem1/><elem2/><elem3/> 
    </linearlayout> 
    #the bottom field (button) 
    <button layout_height=wrap_content layout_with=wrap_content layout_gravity=center_horizontal gravity=center ></button> 
</linearlayout> 
関連する問題