【问题标题】:Can i make Radio Button's Text Editable?我可以使单选按钮的文本可编辑吗?
【发布时间】:2016-12-23 20:31:37
【问题描述】:

我想在应用程序在设备中成功运行后编辑单选按钮的文本。我能做到这一点吗?

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

<RadioGroup
    android:id="@+id/radioGroup1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    android:layout_marginTop="10dp"
    android:orientation="horizontal"
    android:weightSum="2" >

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

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

所以最初我的单选按钮被命名为呼叫和电子邮件。所以当我运行它时,我需要它是可编辑的。

【问题讨论】:

    标签: android-studio radio-button


    【解决方案1】:

    使用这个
    - RadioButton rb = (RadioButton) findViewById(R.id.rbMyAvatars);

    • rb.setText("dfjhdfssdf");

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-05-25
      • 2020-07-22
      • 2013-08-05
      • 1970-01-01
      • 2011-03-16
      • 1970-01-01
      • 2013-02-12
      • 2016-05-06
      相关资源
      最近更新 更多