How to change images for Checkbox

I have two images which are used when check box is checked and unchecked , how do I do this ?
for example,Image1 is displayed in place of checkbox (Unchecked state) after it is checked Image2 will be displayed

First, add Image1 and Image2 as drawable resources.

Next, create a <selector> resource that ties those drawables to particular “checked” states:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="">
    <item android:drawable="@drawable/ic_terms_checkbox_checked" android:state_checked="true" />
    <item android:drawable="@drawable/ic_terms_checkbox_unchecked" android:state_checked="false" />

(here, ic_terms_checkbox_checked and ic_terms_checkbox_unchecked are my two images)

Then, use that <selector> drawable as the background of your CheckBox:

    android:button="@drawable/ic_terms_checkbox" />

(here, ic_terms_checkbox is my <selector> drawable resource)

Thank you
I also want to know that ho w to keep text after (next to ) custom check box image

The location and positioning of the text is part of the CheckBox implementation. AFAIK, you do not have control over that.

After taking checkbox image from selector file , the text given to check box getting part of image , I want to seperate both side by side . Is that possible or I need to create a textview for that

If I understand your problem… you could try playing with android:drawablePadding and see if it affects the relative positioning of the CheckBox image and text. But, if that does not work, setting the CheckBox text to "" and having a separate TextView should work.

Thank you,
Is it possible to make check box as checked by clicking the Text (Text that is written next to checkbox image)

Only if you do that yourself, by adding an OnClickListener to the TextView and having it toggle the CheckBox.

Thank you,
It is working.

I have .ttf file for font view , how to apply this file from java code to change font view

You could set up a font resource and use that font in your app.

Or, use a third-party library for that.

Or, use Typeface along with setTypeface() on TextView.

While doing Espresso testing i’m facing issue in Gradle file, How to resolve it

I have no idea, sorry.

1)I want to know how to perform espresso test for colour change of a button when it is clicked
2)how to Test custom library using Espresso or Junit ( same as app or it has different approach)

My guess is that you will need to write a custom ViewAssertion for that. See this chapter from The Busy Coder’s Guide to Android Development for an example.

In terms of JUnit, there is no significant difference that I can think of.

In terms of Espresso, I have not needed to do that, so I do not know what might be different, sorry.

I would like to know the process for creating Tiles on screen
and i want to provide clickable property for each tile .

Sorry, but I do not know what “tiles” means in this context. I also do not know what “clickable property” means in this context.