私は非常に珍しい問題があります。私は、水平に積まれた線形レイアウトの中にいくつかのToggleButtonを持っています。ボタンの内側のテキスト(textOn、textOff)はセンタリングされていないので、paddingLeftで少し再生した後、右側の各ボタンの15%が「デッドエリア」のものであることがわかりました。それがヒットするときにラッピングしている - これは、なぜそれが適切にセンタリングしていないのかを説明します。ToggleButtonのAndroidのテキストが中央にない
がここにXMLです:私もcenter_horizontalするレイアウトやボタンで重力を設定しようとしました
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/buttons"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="6dip"
android:weightSum="1.5"
android:background="#0094d2"
android:orientation="horizontal">
<ToggleButton
android:id="@+id/button1"
android:layout_weight=".5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="@color/off_white"
android:textStyle="bold"
android:textOn="Button On"
android:textOff="Button Off"
android:background="@drawable/toggle_states"/>
<ToggleButton
android:id="@+id/button2"
android:layout_weight=".5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="@color/off_white"
android:textStyle="bold"
android:textOn="Button On"
android:textOff="Button Off"
android:background="@drawable/toggle_states"/>
<ToggleButton
android:id="@+id/button3"
android:layout_weight=".5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="@color/off_white"
android:textStyle="bold"
android:textOn="Button On"
android:textOff="Button Off"
android:background="@drawable/toggle_states"/>
</LinearLayout>
<View android:background="#999999" android:layout_height="1dip" android:id="@+id/divider" android:layout_below="@+id/buttons" android:layout_width="fill_parent"/>
<ListView
android:id="@+id/listview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:focusable="true"
android:divider="#cccccc"
android:dividerHeight="1dip"
android:layout_below="@+id/divider"
android:fadingEdge="none"/>
</RelativeLayout>
Link to Image, I'm too new so I can't add images yet ><
...明らかに、それは助けにはなりませんでした。
アイデア?
、これはあまりにもそれぞれのトグルボタン: アンドロイド:重力=「センター」 –