1

ダイアログ内に表示するために使用する以下のxmlコードがあります。問題は、「Easy」の文字「E」がラジオボタン自体の下に表示されることです。したがって、表示されません。何故ですか?残りは、対応する各RadioButtonの右側に正しく表示されます。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<RadioGroup
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >

    <RadioButton
        android:id="@+id/radioBtnEasy"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:text="Easy"
        android:layout_weight="1" />

    <RadioButton
        android:id="@+id/radioBtnMedium"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:checked="true"
        android:text="Medium"            
        android:layout_weight="1" />

    <RadioButton
        android:id="@+id/radioBtnHard"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:text="Hard"
        android:layout_weight="1" />
</RadioGroup>

編集

Padma Kumarの要求に応じて、残りのコードを投稿します。これが私がダイアログを表示する方法です。ダイアログの幅を画面の幅に合わせて作成し、コンテンツを折り返さないようにしました。これを削除しましたが、それでもEasyテキストが正しく表示されませんでした。

    //Define a new dialog window
    Dialog dialog = new Dialog(this);
    //Load the predefined layout onto this dialog
    dialog.setContentView(R.layout.new_session_dialog);
    //Set title of dialog
    dialog.setTitle("Create new session");
    //Set the width of the dialog to fill the width of the screen 
    dialog.getWindow().setLayout(WindowManager.LayoutParams.FILL_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);

    //Show the dialog
    dialog.show();
4

4 に答える 4

1

android:ems属性を使用しますが、すべての密度のデバイスでテキストを管理します

于 2012-07-18T11:14:25.507 に答える
1

0dp幅が問題である可能性が最も高いです。

それ以外の場合、最初の文字「E」のみが表示されていない場合は、Easyの前にスペースを入れてください。

例)「Easy」の代わりに「Easy」を入力

于 2012-07-19T03:15:01.773 に答える
1

この質問を投稿していただきありがとうございます。同じ問題が発生しました。最初のラジオボタンのアイコンが、それに続くテキストの最初の文字を踏みつけました。Android1.6エミュレーターを使用しています。アプリをインストールし、アプリを起動してラジオグループを表示すると、問題が発生します。ただし、戻るキーを使用してホーム画面に戻り、アプリを起動してラジオグループを再度表示すると、問題は発生しません。

于 2012-08-22T20:22:01.070 に答える
0

最初にlayout_weight=1を削除し、RadioButtonの幅にfill_parentを配置してみてください。次に、必要な調整を行います。

于 2012-07-18T09:12:59.510 に答える