How can i do TextView UnClickable. ? When I tried with android:clickable="false"
but, it doesn't working for me.
See below XML
code :
<TextView
android:id="@+id/tv_submit"
android:layout_width="match_parent"
android:layout_height="@dimen/btn_height_common"
android:layout_marginTop="@dimen/_15sdp"
android:background="@drawable/back_btn_yellow_rounded"
android:gravity="center"
android:textColor="@color/white"
android:layout_marginRight="@dimen/_20sdp"
android:layout_marginLeft="@dimen/_20sdp"
android:textStyle="bold"
android:alpha="0.50"
android:clickable="false" <!--Hear you can see i set clickable="false-->
android:textSize="@dimen/btn_label_inputtextsize"
android:text="@string/submit"
android:fontFamily="@font/sf_pro_display_bold"/>
Update:
Initialization of Checkbox
:
chk_credit_card = findViewById(R.id.chk_credit_card);
chk_debit_card = findViewById(R.id.chk_debit_card);
chk_bank_deposit = findViewById(R.id.chk_bank_deposit);
chk_in_app_purchase = findViewById(R.id.chk_in_app_purchase);
Work with checkbox code:
for (CheckBox checkBox : chk_credit_card) {
checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@SuppressLint("Range")
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
// one of the checkbox is checked so enable button
tv_submit.setEnabled(true);
tv_submit.setAlpha(150);
tv_submit.setEnabled(true);
/* chk_debit_card.setChecked(false);
chk_bank_deposit.setChecked(false);
chk_in_app_purchase.setChecked(false);*/
} else {
// check if any of check box is checked
boolean isAnyChecked = false;
for (CheckBox box : chk_credit_card) {
if (box.isChecked()) isAnyChecked = true;
}
tv_submit.setEnabled(isAnyChecked);
}
}
});
I refer too much solution but it's not working for me. So please help. :)