2011-01-16 4 views
1

私は4つの列と4つのボタンを持っています。私はそれがすべての行に私はそれが欲しいようにそれらを得たが、それらは一緒にすべてscrunchedされています。とにかくレイアウトにスペースがあるようにするにはどうしますか?列の間隔を取得するandroid sdk

<TableLayout 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:stretchColumns="4"> 

    <TableRow> 

     <Button 
      android:layout_column="1" 
      android:id="@+id/Button01" 
      android:onClick="OnClick" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:background="@drawable/Button01"> 
     </Button> 

     <Button 
      android:layout_column="2" 
      android:id="@+id/Button02" 
      android:onClick="OnClick" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:background="@drawable/Button02"> 
     </Button> 

     <Button 
      android:layout_column="3" 
      android:id="@+id/Button03" 
      android:onClick="OnClick" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:background="@drawable/Button03" > 
     </Button> 

        <Button 
      android:layout_column="4" 
      android:id="@+id/Button04" 
      android:onClick="OnClick" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:background="@drawable/Button04" > 
     </Button> 

    </TableRow> 

</TableLayout> 

答えて

2

私は何かを考えました。列を追加し、各列の間に空白の透明イメージを追加します。かなりうまくいく。

+0

この質問もご覧ください:http://stackoverflow.com/questions/4662038/how-to-separate-icons-from-eachother-android – Stephan

+0

スペースに「空白」の列を追加することに同意するのがベストです! – FROSTYSMOOTH

1

あなたがそれらのボタンのそれぞれにandroid:layout_margin属性を使って実験したいと思う:これは私が持っているものです。上、下、左、右のそれぞれのパディング属性があります。

+0

ボタンを大きくするように見えたのは、実際には何も配置されていなかったということです。 – Christian

+2

ああ、申し訳ありません、アンドロイド:layout_marginを試してください。それはトリックを行う必要があります。 –

+0

@HakanOzbay次に回答バディを編集してください:) – Dipin

関連する問題