Android复选框应用程序:checked = true,不显示复选标记

问题描述:

当使用视图模型设置复选框属性时,如果app:checked以编程方式设置,它不会显示像图片中的大纲。其他一切按预期工作。有没有人看过这个或可以帮助?Android复选框应用程序:checked = true,不显示复选标记

Notice the first checkbox is not checked, and app:checked = true is set programmatically using a viewModel.

+1

添加您的代码。 –

<CheckBox 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Your text" 
     android:checked="true" 
     /> 

checkbox.setChecked(true);