次のようなレイアウトがあるとします。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" >
<TextView
android:id="@+id/greeting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello, world!" />
<LinearLayout
android:id="@+id/actions"
style="?android:attr/buttonBarStyle"
android:background="#dddddd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<Button
android:id="@+id/button1"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="Button1" />
<Button
android:id="@+id/button2"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="Button2" />
</LinearLayout>
</RelativeLayout>
Eclipse でレンダリングすると、次のようになります。
ButtonBar の周りに余白があることに注意してください。残りのアクティビティに影響を与えずにこれを削除する方法はありますか? 属性を変更するとandroid:padding*
、「Hello, world!」アクティビティの左側にぶつかります。