Different attributes of CheckedTextView

Attributes Description
android:id Gives a unique ID to the Textview.
android:gravity We can align text of the Textview vertically or horizontally or both.
android:height Used to set height of the Textview.
android:width Sets width of the TextView.
android:padding Used to set padding.
android:checkMark Used to set the drawable for checkmark.
android:checkMarkTint Used to set tint to the check mark.
android:checkMarkTintMode Blending mode used to apply the check mark tint.
android:checked Used to set the initial checked state of the checkedTextView which is false by default.

CheckedTextView in Kotlin

CheckedTextView is used to implement checkable interface where one can tick or check the needed or required items and leave out the rest. In this article, we will be discussing how to make a CheckedTextView manually.

The first step is to make or create a project in Android Studio. Here, we will be creating a project named CheckedTextViewInKotlin.

For creating a new project:

  1. Click on File, then New => New Project
  2. Then, check Include Kotlin Support and click next button.
  3. Select minimum SDK, whatever you need.
  4. Select Empty activity and then click finish.

Similar Reads

Different attributes of CheckedTextView:

Attributes Description android:id Gives a unique ID to the Textview. android:gravity We can align text of the Textview vertically or horizontally or both. android:height Used to set height of the Textview. android:width Sets width of the TextView. android:padding Used to set padding. android:checkMark Used to set the drawable for checkmark. android:checkMarkTint Used to set tint to the check mark. android:checkMarkTintMode Blending mode used to apply the check mark tint. android:checked Used to set the initial checked state of the checkedTextView which is false by default....

Modify the activity_main.xml file

In this file, we will add the CheckedTextView and use different attributes like checked, gravity etc. Later, it will be called in Kotlin file to add more functionalities....

Contact Us