Android的 - 单选按钮不显示其Text单选、按钮、Android、Text

2023-09-06 18:41:39 作者:性格孤僻无人爱

我的应用程序有一个单选按钮组作为RelativeLayout的一部分。我的问题是,单选按钮不会显示其文本。我得到的是按钮本身。

My app has a radio button group as part of a RelativeLayout. My problem is that the RadioButtons are not showing their text. All I get is the buttons themselves.

下面是XML:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/setupTabLayout"
    android:scaleType="fitXY"
    android:background="#ffffff" 
    android:layout_height="fill_parent" 
    android:layout_width="fill_parent" 
    android:baselineAligned="true" 
    android:orientation="vertical">

    <TextView android:id="@+id/textView1" 
        android:text="Total Points" 
        android:textColor="#000000"
        android:textSize = "30sp"
        android:layout_height="wrap_content" 
        android:layout_width="wrap_content" 
        android:paddingBottom="5px"
        android:layout_gravity="top"
        android:layout_alignParentLeft="true"
        ></TextView>

      <EditText android:id="@+id/editTextTotal" 
        android:text="" 
        android:digits="-0123456789."
        android:windowSoftInputMode="stateVisible"
        android:focusable="true"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:layout_alignTop="@+id/textView1" 
        android:layout_alignBottom="@+id/textView1"
        android:layout_toRightOf="@+id/textView1" 
    ></EditText>

    <RadioGroup android:id="@+id/radioGroup1"  
        android:layout_height="wrap_content" 
        android:layout_width="wrap_content" 
        android:layout_alignParentLeft="true"
        android:layout_above="@+id/textView2"
    > 

        <RadioButton android:id="@+id/radioButton1" 
            android:checked="true" 
            android:text="Points" 
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"  
        ></RadioButton>

        <RadioButton android:id="@+id/radioButton2" 
            android:text="Points" 
            android:layout_height="wrap_content" 
            android:layout_width="wrap_content"
            android:layout_toRightOf="@+id/radioButton1" 
        ></RadioButton>

    </RadioGroup>   

    <TextView android:id="@+id/textView2" 
        android:text="Points Per = " 
        android:textColor="#000000"
        android:textSize = "30sp"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:paddingBottom="5px"
        android:layout_above="@+id/numberPadLayoutContainer"
        android:layout_alignParentLeft="true"
    ></TextView>

    <EditText android:id="@+id/editTextPoints" 
        android:text="" 
        android:digits="-0123456789."
        android:windowSoftInputMode="stateVisible"
        android:focusable="true"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:layout_alignTop="@+id/textView2" 
        android:layout_alignBottom="@+id/textView2"
        android:layout_toRightOf="@+id/textView2" 
    ></EditText>

    <include layout="@layout/numerickeyboard" />

</RelativeLayout>  

任何想法,为什么文本没有显示?

Any ideas why the text isn't showing?

推荐答案

布局背景为白色,也对单选按钮是白色的。它们显示你刚才没有看到他们。

Your Layout background is white and also the texts on the RadioButtons are white. They are displayed you just don't see them.

您可以尝试设置的android:文字颜色=#000来使TE文本黑色

You can try and set android:textColor="#000" to make te texts black.