Android 安卓单选按钮文本赢得';不能正确显示

Android 安卓单选按钮文本赢得';不能正确显示,android,Android,下面是我用来在对话框中显示的xml代码。问题是“Easy”中的字母“E”显示在单选按钮下方。所以它不可见。为什么呢?其余部分正确显示在每个相应单选按钮的右侧 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="ver

下面是我用来在对话框中显示的xml代码。问题是“Easy”中的字母“E”显示在单选按钮下方。所以它不可见。为什么呢?其余部分正确显示在每个相应单选按钮的右侧

<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>

首先尝试删除布局重量=1,并将填充父项置于RadioButton宽度上。然后进行必要的调整。

使用android:ems属性,但在所有密度设备上管理文本

最有可能的问题是0dp宽度

否则,如果只有第一个字符“E”未显示,请在Easy前面加空格


Ex)不要用“简单”,而是用“简单”

谢谢你发布这个问题。我遇到了同样的问题:第一个单选按钮中的图标在它后面文本的第一个字母上跺了跺脚。我使用的是安卓1.6模拟器。安装应用程序后,启动应用程序并显示广播组,我发现问题。然而,当我使用“后退”键将我带回主屏幕并启动我的应用程序并再次显示广播组时,我看不出问题所在

只需在android:text=“Easy”这样的空间中放置一个空格,也有其他解决方案,但通过这种方式,您不必选择任何其他android标记,例如padding,,等等,您的代码对我来说运行良好。将您正在添加的其他内容发布到此处。@Padma Kumar。除此之外:
dialog.getWindow().setLayout(WindowManager.LayoutParams.FILL\u父项,WindowManager.LayoutParams.WRAP\u内容)我用来设置对话框的宽度以匹配屏幕,没有任何其他代码。@Vipin Sahu。是的,我提出了相同的解决方案,但我真的很想知道原因,并修复它:)这可能是因为您正在使用单选组作为所有单选按钮的父布局,我认为您可以使用android:layout\u margin=“2dp”作为单选按钮,这样单选组就不会填满该空间。。。。。
    //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();