1

現在、タブ内のフラグメントに使用されるこのレイアウト ファイルがあります。

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout  xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_vertical"
    android:orientation="vertical" >

          <TableRow
              android:paddingTop="10dip"
              android:paddingLeft="10dip"
              android:paddingRight="10dip"
              android:paddingBottom="3dip"
              android:layout_width="match_parent"
              android:layout_height="wrap_content">
          <Button
            android:id="@+id/Btn_Show"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Button 1" />
          <Button
            android:id="@+id/button2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Button 2" />
         </TableRow>
          <TableRow
              android:paddingTop="10dip"
              android:paddingLeft="10dip"
              android:paddingRight="10dip"
              android:paddingBottom="3dip"
              android:layout_width="match_parent"
              android:layout_height="wrap_content">
          <Button
            android:id="@+id/button3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Button 3" />
          <Button
            android:id="@+id/button4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Button 4" />
        </TableRow>

</LinearLayout>
</FrameLayout>

現在、ボタンは縦方向に中央に表示されていますが、下の画像のように横方向にも中央に表示されるようにしたいと考えています。

ここに画像の説明を入力

Android:layout_gravity="center_vertical | horizo​​ntal" のさまざまな方法を使用してみましたが、うまくいかないようです

前もって感謝します。

4

2 に答える 2