我想限制用户更改它。我应该能够以编程方式更改它,但不能由用户更改。我试过了,可编辑,可点击出来都不行。
应该怎么做?
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:paddingLeft="8dip"
android:paddingRight="8dip">
<androidx.appcompat.widget.AppCompatCheckBox
android:id="@+id/flight_origin_date"
style="@style/InputCheckBox"
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="@string/new_order_flight_origin_date"
android:visibility="visible"
android:layout_weight="1"
android:layout_marginBottom="0dp"
app:buttonTint="@color/i6_teal" />
</LinearLayout>
最佳答案
请在androidx.appcompat.widget.AppCompatCheckBox 中将以下两个字段设置为
false
android:clickable="false"
android:focusable="false"
关于android - 使复选框不可由用户编辑,但可通过编程方式编辑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59054455/