<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_margin="4dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<ImageView
android:id="@+id/ngo_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<font.CustomFontTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:textColor="@android:color/black"
android:id="@+id/ngo_name"
app:typeface="roboto_bold" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<CheckBox
android:id="@+id/check_ngo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black_tint"
android:textSize="13dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ngo_desc_text"
android:textStyle="bold"
android:textColor="@color/black_tint"
android:visibility="gone"
/>
</LinearLayout>
</LinearLayout>
Here is the code for checkbox in xml file, I am calling this file in inflator layout (if relevant) and it shows blue tick mark when checked.
When checkbox is viewed inside phone:
When checkbox is viewed inside Android Studio:
Use buttonTint for the box: (API level 23)
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:buttonTint="@color/black_tint" />
For older APIs use :
<android.support.v7.widget.AppCompatCheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:buttonTint="@color/black_tint" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.