单选按钮仅部分检查

Rob*_*hof 13 android android-layout android-radiogroup android-radiobutton

我知道这听起来很怪异,所以这是图片.

在此输入图像描述

它保持正确的价值.选择(部分)正确的单选按钮.其中的所有逻辑OnCheckedChangeListener都正确执行.我完全惊呆了.为什么没有完全检查单选按钮?

我唯一能想到的就是我正在使用 Rx2Firebase

periodRetriever = FirebaseHelper.getInstance(getContext()).getPeriod()
        .defaultIfEmpty(0)
        .distinctUntilChanged()
        .subscribe(new Consumer<Integer>() {
            @Override
            public void accept(@NonNull Integer headerType) throws Exception {
                getRadioViewChecked(headerType).setChecked(true);
            }
        });
Run Code Online (Sandbox Code Playgroud)

EDIT1

马科斯建议我看不到白蜱.不是这种情况. 在此输入图像描述

EDIT2

布局:

<RadioGroup
    android:id="@+id/rgPeriod"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">

    <android.support.v7.widget.AppCompatRadioButton
        android:id="@+id/rbMonth"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:checked="false"
        android:text="@string/month" />

    <android.support.v7.widget.AppCompatRadioButton
        android:id="@+id/rbWeek"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:checked="false"
        android:text="@string/week" />

    <android.support.v7.widget.AppCompatRadioButton
        android:id="@+id/rb4Weeks"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:checked="false"
        android:text="@string/four_weeks" />


</RadioGroup>
Run Code Online (Sandbox Code Playgroud)

Nip*_*per 20

看起来像动画Bug.在ViewPager内的Fragment上使用CompoundButton时,未正确设置可绘制状态.

这也发生在Checkboxes中,如下所示:Android Nougat:为什么在以编程方式选择时,Fragment上的复选框具有不完整的状态(但在Lollipop上看起来很好).

在调用RadioGroup.check(id)或Checkbox.setChecked(true)之后调用jumpDrawablesToCurrentState()似乎解决了问题(thx @Dalmas)