【发布时间】:2015-10-09 17:54:59
【问题描述】:
我正在使用 Android Studio,我的项目中有一个包含 4 个按钮的单选按钮组的应用程序,用于从我的数据库中选择答案。这些按钮在设备上是不可见的,但仍然可以单击它们,因为它们在单击时显示为绿色。此外,没有为每个答案显示文本,但显示了单选按钮上方 textview 中的问题文本!很混乱。有没有人遇到过这个问题并知道如何解决?这是我的 xml 布局的副本
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal"
android:background="@drawable/background">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="15dip"
android:paddingBottom="15dip"
android:gravity="center_horizontal">
<ImageView android:id="@+id/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/logo2" />
</LinearLayout>
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="5dip"
android:paddingBottom="5dip"
android:gravity="center_horizontal">
<RadioGroup android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/group1">
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:textStyle="bold"
android:id="@+id/question"/>
<RadioButton android:checked="false" android:id="@+id/answer1"
/>
<RadioButton android:checked="false" android:id="@+id/answer2"
/>
<RadioButton android:checked="false" android:id="@+id/answer3"
/>
<RadioButton android:checked="false" android:id="@+id/answer4"
/>
</RadioGroup>
</LinearLayout>
<Button android:text="Next"
android:id="@+id/nextBtn"
android:layout_width="wrap_content"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:background="@drawable/button_selector"
android:paddingTop="5dip"
android:paddingBottom="5dip"
android:textColor="#ffffff"
android:layout_gravity="center_horizontal" />
</LinearLayout>
【问题讨论】:
-
我找不到您更改单选按钮文本颜色的位置。您将 textview 的文本颜色更改为白色...也许您有一个带有黑色文本和黑色图标的黑色 bavkground?
-
尝试更改您的主视图背景,可能它与您的文本和 RadioButton 背景颜色相同。这就是为什么它们对你来说是隐形的。
-
我已经厌倦了改变背景,文本在黑色背景上是白色的,文本视图中的上面的文本显示很好,但只是收音机组不可见
-
刚试过,还是一样的问题
-
你的 Run code sn-p 按钮有什么作用?它什么也没显示。
标签: android android-studio android-radiogroup