【问题标题】:cannot resolve symbol getCheckedRadioButtonId无法解析符号 getCheckedRadioButtonId
【发布时间】:2016-09-06 02:39:00
【问题描述】:

我是 android 新手,我在 java 代码中遇到了这个问题

cannot resolve symbol 'getCheckedRadioButtonId'

关于这段代码

Bind(R.id.radioGroup) RadioGroup _radioGroup;

    if (_radioGroup.getCheckedRadioButtonId() != -1)
    {

    }

它没有收到getCheckedRadioButtonId。我想检查来自RadioButton 的文本。我该怎么做?

【问题讨论】:

  • 它返回该组中所选单选按钮的 id,因此测试将类似于 if (_radioGroup.getCheckedRadioButtonId() != R.id.myBox)
  • 你在用ButterKnife吗?
  • 是的,我用的是黄油刀
  • 我看不懂请多说@OussemaAroua
  • getCheckedRadioButtonId()返回RadioGroup内radioButton的id,需要比较getCheckedRadioButtonId()返回的值和RadioButtons的id

标签: android android-radiogroup android-radiobutton


【解决方案1】:
apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.example.elhez.tammeni"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:design:23.3.0'
    compile 'com.jakewharton:butterknife:7.0.1'

    compile 'com.google.android.gms:play-services-appindexing:8.1.0'
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-11-11
    • 1970-01-01
    • 1970-01-01
    • 2021-02-04
    • 2016-12-31
    • 1970-01-01
    相关资源
    最近更新 更多