フッタにボタンを表示する4.0

4.0以前はこちら

フッタにボタンを表示する - 明日の鍵 
http://d.hatena.ne.jp/tomorrowkey/20110809/1312869978

ボタン2つ


この画面のレイアウトファイルはどうなっているかソースを探す

uninstall_confirm.xml

<!-- OK confirm and cancel buttons.  -->
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:divider="?android:attr/dividerHorizontal"
    android:showDividers="beginning"
    android:paddingTop="16dip">

  <LinearLayout
      style="?android:attr/buttonBarStyle"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="horizontal"
      android:measureWithLargestChild="true">

    <LinearLayout android:id="@+id/leftSpacer"
      android:layout_weight="0.25"
      android:layout_width="0dip"
      android:layout_height="wrap_content"
      android:orientation="horizontal"
      android:visibility="gone" />

    <Button android:id="@+id/cancel_button"
      android:layout_width="0dip"
      android:layout_height="wrap_content"
      android:layout_gravity="left"
      android:layout_weight="1"
      android:text="@string/cancel"
      android:maxLines="2"
      style="?android:attr/buttonBarButtonStyle" />

    <Button android:id="@+id/ok_button"
      android:layout_width="0dip"
      android:layout_height="wrap_content"
      android:layout_gravity="right"
      android:layout_weight="1"
      android:text="@string/ok"
      android:maxLines="2"
      style="?android:attr/buttonBarButtonStyle" />

    <LinearLayout android:id="@+id/rightSpacer"
      android:layout_width="0dip"
      android:layout_weight="0.25"
      android:layout_height="wrap_content"
      android:orientation="horizontal"
      android:visibility="gone" />

  </LinearLayout>
</LinearLayout>

ボタン1つ

軽く探したけど、だいたいActionBarで実現してるみたい
レイアウトで実装したいなら以下でそれっぽくできる

<LinearLayout
  style="?android:attr/buttonBarStyle"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:measureWithLargestChild="true"
  android:orientation="horizontal" >

  <Button
    android:id="@+id/done_button"
    style="?android:attr/buttonBarButtonStyle"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:drawableLeft="@drawable/ok"
    android:drawableRight="@drawable/space"
    android:maxLines="2"
    android:text="@string/done" />
</LinearLayout>