2012-05-09 8 views
0

ここに私のレイアウトアンドロイドlyoutスティックボタンを一緒

<LinearLayout 
    android:id="@+id/toolbar" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_below="@id/image" 
    android:layout_gravity="bottom" 
    android:layout_marginTop="5dp" 
    > 


    <Button 
     android:layout_weight="1.0" 
     android:id="@+id/button1" 
     style="@style/ActionButtonText" 
     android:background="@drawable/action_button_left" 
     android:focusable="false" 
     android:focusableInTouchMode="false" 
     android:text="Button" > 
    </Button> 

    <Button 
     android:layout_weight="1.0" 
     android:id="@+id/button1" 
     style="@style/ActionButtonText" 
     android:background="@drawable/action_button_center" 
     android:focusable="false" 
     android:focusableInTouchMode="false" 
     android:text="Button" > 
    </Button> 

    <Button 
     android:layout_weight="1.0" 
     android:id="@+id/button1" 
     style="@style/ActionButtonText" 
     android:background="@drawable/action_button_center" 
     android:focusable="false" 
     android:focusableInTouchMode="false" 
     android:text="Button" > 
    </Button> 

    <Button 
     android:layout_weight="1.0" 
     android:id="@+id/button1" 
     style="@style/ActionButtonText" 
     android:background="@drawable/action_button_right" 
     android:focusable="false" 
     android:focusableInTouchMode="false" 
     android:text="Button" > 
    </Button> 

であり、これは彼らが私がやろうとしています何

enter image description here

を見てどのようであるので、ボタンの間のギャップを削除しています彼らはこのようにまとまって見える。

enter image description here

私はパディングとマージンを使用していますが、動作させることができませんでした。どうすれば達成できますか? おかげ

答えて

1

enter image description here

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/toolbar" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_gravity="bottom" 
    android:layout_marginTop="5dp" > 


    <Button 
     android:id="@+id/button1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="1.0" 
     android:focusable="false" 
     android:focusableInTouchMode="false" 
     android:text="Button" > 
    </Button> 

    <Button 
     android:id="@+id/button1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="-10dp" <------ it will work....(minus 10) 
     android:layout_weight="1.0" 
     android:focusable="false" 
     android:focusableInTouchMode="false" 
     android:text="Button" > 
    </Button> 

    <Button 
     android:id="@+id/button1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="-10dp" 
     android:layout_weight="1.0" 
     android:focusable="false" 
     android:focusableInTouchMode="false" 
     android:text="Button" > 
    </Button> 

    <Button 
     android:id="@+id/button1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="-10dp" 
     android:layout_weight="1.0" 
     android:focusable="false" 
     android:focusableInTouchMode="false" 
     android:text="Button" > 
    </Button> 

</LinearLayout> 
+0

何も変更しませんでしたか? – MAC

0

はアンドロイドを追加:オリエンテーションあなたのLinearLayoutに= "水平"

+0

は、あなたがこれを試してみる – nLL