2012-02-19 8 views
6

ボタンの高さを大きくしようとしています。私は列を膨らませようとしているが、何のアイデアも出ていない?相対的なレイアウトとtablelayotと私の更新されたコードボタンを大きくするにはどうすればいいですか

チェックアウト...

は、行とtablelayout同じ結果を拡大しようとした...

は私がENL XML

<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="@drawable/black_bg" 
android:layout_centerVertical="true">  
<TableLayout android:id="@+id/row1" 
android:layout_width="fill_parent" 
android:layout_height="45dip" 
    android:paddingRight="5px" 
    android:paddingLeft="5px" 
    android:paddingTop="15px" 
    android:paddingBottom="5px" 
    android:layout_weight="1"> 
<TableRow 
    android:layout_weight="1" 
    android:layout_height="50dip"> 
    <ToggleButton android:id="@+id/btn_service_plus" 
     android:layout_marginRight="4px" 
     android:textColor="@android:color/white" 
     android:textStyle="bold" 
     android:textSize="12dip" 
     android:layout_width="0dp" 
     android:layout_height="fill_parent" 
     android:text="1" 
     android:layout_weight="1" 
     /> 
<Button 
     android:layout_marginLeft="4px" 
     android:layout_marginRight="4px" 
     android:textColor="@android:color/white" 
     android:textStyle="bold" 
     android:layout_width="0dp" 
     android:layout_height="fill_parent" 
     android:textSize="12dp" 
     android:layout_weight="1" 
     /> 

<Button 
     android:layout_marginLeft="4px" 
     android:layout_marginRight="4px" 
     android:textColor="@android:color/white" 
     android:textStyle="bold" 
     android:layout_width="0dp" 
     android:layout_height="fill_parent" 
     android:textSize="12dp" 
     android:layout_weight="1" 
     /> 


<ToggleButton 
    android:layout_marginLeft="4px" 
     android:textColor="@android:color/white" 
     android:textStyle="bold" 
     android:layout_width="0dp" 
     android:layout_height="fill_parent" 
     android:textSize="12dp" 
     android:layout_weight="1" 
     android:background="@drawable/menu_button_layout"/> 
</TableRow> 
+0

がボタンの幅は少なくとも1DP置きます。 – Deepak

+0

@Deepak彼は 'layout_weight' - ' 0dp'を使っています。ここでは幅が唯一の正しい選択です。彼はまた、幅ではなく高さを変更したいと考えています。 –

+0

行の高さを増やしてみましたか?正確に「働いていない」とは何ですか? – Asahi

答えて

0

を試してみましたあなたのコードを今すぐチェック

<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="@drawable/black_bg" 
android:layout_centerVertical="true">  
<TableLayout android:id="@+id/row1" 
android:layout_width="fill_parent" 
android:layout_height="100dip" 
android:paddingRight="5px" 
android:paddingLeft="5px" 
android:paddingTop="15px" 
android:paddingBottom="5px" 
> 
<TableRow 
android:layout_weight="1" 
android:layout_height="50dip"> 
<ToggleButton android:id="@+id/btn_service_plus" 
    android:layout_marginRight="4px" 
    android:textColor="@android:color/white" 
    android:textStyle="bold" 
    android:textSize="12dip" 
    android:layout_width="0dp" 
    android:layout_height="fill_parent" 
    android:text="1" 
    android:layout_weight="1" 
    /> 
<Button 
    android:layout_marginLeft="4px" 
    android:layout_marginRight="4px" 
    android:textColor="@android:color/white" 
    android:textStyle="bold" 
    android:layout_width="0dp" 
    android:layout_height="fill_parent" 
    android:textSize="12dp" 
    android:layout_weight="1" 
    /> 

<Button 
    android:layout_marginLeft="4px" 
    android:layout_marginRight="4px" 
    android:textColor="@android:color/white" 
    android:textStyle="bold" 
    android:layout_width="0dp" 
    android:layout_height="fill_parent" 
    android:textSize="12dp" 
    android:layout_weight="1" 
    /> 


<ToggleButton 
    android:layout_marginLeft="4px" 
    android:textColor="@android:color/white" 
    android:textStyle="bold" 
    android:layout_width="0dp" 
    android:layout_height="fill_parent" 
    android:textSize="12dp" 
    android:layout_weight="1" 
    android:background="@drawable/menu_button_layout"/> 
</TableRow> 
4

I mパーティーに少し遅れているかもしれませんが、CJBS(アクラムのコメントを参照)は正しいと思います。残念ながら、私はコメントをすることはできませんので、私はこれを回答として投稿します(私は答えを与えるためにも良いはずです)。

OPの答えが既に回答されているので、私は同じ質問を持つ人々を助けるの答えを提供します:

これは、ボタンのテキストが大きくなります。

android:textSize="" 

このボタンの高さが大きくなります。

android:height="" 

これはボタン幅が大きくなります

android:width="" 

EDIT:

「幅」や「高さ」の前に「分」を使用しても良い考えかもしれません。

例:

android:minWidth="" 
関連する問題