Friday, 7 February 2020

How to set check box in android or set check box with multiple line text in android

In the checkbox is compound button in android widget it is working as check for select item. And you can set more than one line for check box also single line or more . It means you can set minimum line of text in check box.

In layout XML :

<?xml verion="1.0" encoding="utf-8"?>
<LinearLayout xmls:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="top"
    android:gravity="top"
    android:orientation="vertical">

    <CheckBox
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:minLines="2"
       android:text="This is just dummy text for example. This is just dummy text
                  for example. This is just dummy text for example. This is just
                  dummy text for example."
       android:gravity="top"
       android:textSize="16sp"
       android:textColor="@color/colorBlack"/>
</LinearLayout>



Thanks

No comments:

Post a Comment