2

ラジオ ボタン グループまたはラジオ ボタン xml コードの問題を教えてください。「HTC Sensation」などの一部のデバイスでは、ラジオ ボタンの円がテキストに表示されます。何が問題なのかわからない。私を助けてください...

このリンクは HTC Sensation の写真です: https://www.dropbox.com/s/7gjvn09kplv5zqf/HTC%20Sensation.jpg?dl=0

これはシミュレーターの写真です: https://www.dropbox.com/s/tdnpc5vfdf9l1n9/Simulator.png?dl=0

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

        <TextView
            android:id="@+id/TextView01"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="20dp"
            android:layout_marginTop="10dp"
            android:paddingLeft="10dp"
            android:paddingRight="10dp"
            android:text="@string/dialog_choose_music"
            android:textColor="#ffffff"
            android:textSize="18sp" />

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

            <RadioGroup
                android:id="@+id/selectMusicRadioGroup"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/between_games_timer"
                android:orientation="vertical" >

                <RadioButton
                    android:id="@+id/silent"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="3dp"
                    android:background="@drawable/bg_color_selector"
                    android:checked="true"
                    android:ellipsize="end"                        
                    android:tag="silent"
                    android:maxLines="1"
                    android:paddingBottom="15dp"
                    android:paddingLeft="10dp"
                    android:paddingRight="10dp"
                    android:paddingTop="15dp"
                    android:singleLine="true"
                    android:text="@string/silent"
                    android:textColor="#ffffff"
                    android:textSize="16sp" >
                </RadioButton>

                <RadioButton
                    android:id="@+id/myMusic"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="3dp"
                    android:background="@drawable/bg_color_selector"
                    android:ellipsize="end"
                    android:tag="my_music"
                    android:maxLines="1"
                    android:paddingBottom="15dp"
                    android:paddingLeft="10dp"
                    android:paddingRight="10dp"
                    android:paddingTop="15dp"
                    android:singleLine="true"
                    android:text="@string/custom_music"
                    android:textColor="#ffffff"
                    android:textSize="16sp" >
                </RadioButton>
            </RadioGroup>
        </LinearLayout>
</LinearLayout>
4

2 に答える 2

1

一部のデバイスでは、ラジオ ボタンとチェックボックスのパディングがサポートされていません。Android は内部で padding 属性を使用してテキストと画像を配置するため、自分で padding を変更すると台無しになります。

パディングを削除し、代わりにそれを含むレイアウトでマージンを使用してください。

于 2014-09-13T15:07:52.990 に答える
0

RadioButton で使用した「パディング」属性は、テキストにのみ適用されます。また、Android は RadioButton/CheckBox の円をドローアブルとして扱います。(ラジオボタンには drawableTop、drawableBottom などがあることがわかります)。

したがって、円にパディングを適用するには、次のように「drawablePadding」属性を使用する必要があります。

<RadioButton
                android:id="@+id/myMusic"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="3dp"
                android:drawablePadding="10dp" />
于 2014-09-13T15:34:04.080 に答える