checked: This attribute is used to set the current state of the CheckedTextView. tCheckMarkDrawable(R.drawable.checked) // set drawwable for check mark for CheckedTextViewģ. Setting checkMark In Java Class: CheckedTextView simpleCheckedTextView = (CheckedTextView) findViewById(R.id.simpleCheckedTextView) // initiate a CheckedTextView PS: First save the image name as checked in drawable folder before using below code. checkmark: This attribute is used to set the drawable for the check mark. id: This attribute is used to uniquely identify a CheckedTextView.Ģ. Now let’s we discuss some important attributes that helps us to configure a CheckedTextView in your xml file.ġ. You can also download the image by click on it below.ĬheckedTextView simpleCheckedTextView = (CheckedTextView) findViewById(R.id.simpleCheckedTextView) // initiate a CheckedTextViewīoolean checkedValue = simpleCheckedTextView.isChecked() // check current state of CheckedTextView Very Important Note: Before using any code on this article make sure to download this image and save it in your drawable folder named as checked. Another thing is we can’t change the state of check mark only by clicking on the UI, instead we have to use a listener to do that. Important Note: In CheckedTextView we have to set android:checkMark attribute to provide a graphic or drawable otherwise it will not show the check mark and behaves like a normal TextView. checkmark attribute is used to provide a graphic or a drawable to CheckedTextView. It is mainly used in a ListView where we want to show which item is selected or not. In Android, CheckedTextView is an extension of normal TextView that supports the checkable interface and displays it. CheckedTextView Tutorial With Example In Android Studio
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |