android - 更改单选按钮的文本格式并获取所有国家/地区的列表并将其放入微调器 Android

标签 android radio-button spinner

您好,下面是一个 Activity 的屏幕截图,其中包含供用户填写的详细信息列表。如您所见,选择性别单选按钮与 Activity 中的其余文本不匹配。它们是一种粗体文本。我想让它类似于 Activity 中的剩余文本,我该怎么做?

此外,我不想让用户键入州和国家名称,而是想在微调器中提供所有国家/地区的列表,并且根据所选国家/地区,州微调器应填充所选国家/地区的城市。我该怎么做?

enter image description here

下面是上述 Activity 的 xml 代码

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".RegisterActivity" >

<TextView
    android:id="@+id/textView6"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string/topic"
    android:textAppearance="?android:attr/textAppearanceLarge" />

<TextView
    android:id="@+id/textView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="20dp"
    android:text="@string/full_name" />

<EditText
    android:id="@+id/fname"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:ems="10"
    android:inputType="textPersonName" >

    <requestFocus />
</EditText>

<TextView
    android:id="@+id/textView2"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string/email" />

<EditText
    android:id="@+id/email"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:ems="10"
    android:inputType="textEmailAddress" />

<TextView
    android:id="@+id/textView3"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string/age" />

<EditText
    android:id="@+id/age"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:ems="10"
    android:inputType="number" />

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

    <RadioButton
        android:id="@+id/radioMale"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/radio_male" />
    <RadioButton
        android:id="@+id/radioFemale"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/radio_female" />
</LinearLayout>

<TextView
    android:id="@+id/textView4"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string/postal_address" />

<EditText
    android:id="@+id/address"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:ems="10"
    android:inputType="textPostalAddress" />

<TextView
    android:id="@+id/textView5"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string/state" />

<EditText
    android:id="@+id/state"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:ems="10"
    android:inputType="textCapWords" />

<TextView
    android:id="@+id/textView7"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string/country" />

<EditText
    android:id="@+id/country"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:ems="10"
    android:inputType="textCapWords" />

<Button
    android:id="@+id/done"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/done" />

最佳答案

为每个或您的单选按钮尝试 android:textAppearance="?android:attr/textAppearanceSmall"

关于android - 更改单选按钮的文本格式并获取所有国家/地区的列表并将其放入微调器 Android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22525873/

相关文章:

android - 什么工具可以向安卓手机发送推送通知?

html - 多个提示的单选按钮自定义样式

java - 当项目列在 strings.xml 中而不是 Android Studio 中的静态项目时,如何删除在按钮上单击 Spinner 中选择的项目?

android - 在 sqlite 中存储微调器的选定值

android - 如何从具有两个项目的微调器中获取选定值

android - 如何以编程方式将 tableRow 添加到 Xamarin 中的 TableLayout

android - 从外部类文件中定义的监听器启动 Android Activity

android - 从交易短信中获取商家名称 - Android

ruby-on-rails - 使用 Rails form_for 的漂亮单选按钮

css - bootstrap 3 按钮组突出显示第 n 个 child