あなたの質問から、背景画像の左右の透明なエッジにボタンを配置することは避けたいと思います。android:layout_marginLeft
これにはとを使用できますandroid:layout_marginRight
。コードの場合、次のようになります。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/fond"
>
<ImageView
android:id="@+id/imageView1"
android:contentDescription="@string/desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/top"
android:layout_gravity="top"
android:adjustViewBounds="true"
/>
<LinearLayout
android:layout_below="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/fond1"
>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp" <!--Use the correct dp value, i just use it for example -->
android:layout_marginRight="30dp" <!--Use the correct dp value, i just use it for example -->
android:weightSum="3"
>
<Button
android:id="@+id/button_garçon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Bg"
android:background="@drawable/button_purple"
android:layout_weight="1"
android:textColor="#ffffff"
android:onClick="actionGarçon"
/>
<Button
android:id="@+id/button_mixte"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Bm"
android:background="@drawable/button_purple"
android:layout_weight="1"
android:textColor="#ffffff"
android:onClick="actionMixte"
/>
<Button
android:id="@+id/button_fille"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Bf"
android:background="@drawable/button_purple"
android:layout_weight="1"
android:textColor="#ffffff"
android:onClick="actionFille"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>