13

Layout i implemented like below picture :

enter image description here

And code I used is :

 <CheckedTextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/big_green_btn_normal"
        android:checkMark="@drawable/check_circle"
        android:gravity="center_vertical"
        android:text="@string/register_tempClickStaffingAgreement" />
    

This what i wanted,like the following picture :

enter image description here

Share some idea to customize it but not with custom linear or any other layout..i want a single custom view or checkedTextView...any help would be greatly appreciated.

Thanks..!!

Community
  • 1
  • 1
Reprator
  • 2,859
  • 2
  • 32
  • 55
  • 1
    i don't know why u guys had down voted but i don't care for that....if u guys have downvoted my question,,,then probably u know the answer....so tell me or share it guys.....i already had wasted a lot of time on this – Reprator Oct 21 '15 at 05:05

1 Answers1

52

Please try below code to implement checkview as you mentioned :

<CheckedTextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@android:color/darker_gray"
        android:checkMark="@android:drawable/checkbox_on_background"
        android:gravity="center"
        android:text="Tempclick Staffing Agreement"
        android:textAlignment="gravity" />

Thanks..!!

AndiGeeky
  • 11,266
  • 6
  • 50
  • 66
  • Thanks @AndiGeeky, your answer is very helpful to me...can you please align the checkmark alongwith textview....and thank you again – Reprator Oct 21 '15 at 05:56
  • @ Vikram Singh : Did not get your point .. Will you please explain more..!! – AndiGeeky Oct 21 '15 at 06:13
  • i just want to align the checkmark along with text like done in this application( 2 Image) https://github.com/pnc/IconButton – Reprator Oct 21 '15 at 06:15
  • @ Vikram Singh : Please add image url..! – AndiGeeky Oct 21 '15 at 06:17
  • here is the image url,https://github.com/pnc/IconButton/blob/master/images/demo.png?raw=true – Reprator Oct 21 '15 at 06:19
  • @VikramSingh Did you find the solution? – sofs1 Sep 26 '16 at 08:29
  • @VikramSingh: I have not tried yet. Can you please add question with more details and send me link? – AndiGeeky Sep 26 '16 at 08:40
  • @AndiGeeky The question is to make the tick mark center along with the text (temp click staffing agreement) . Right now the text alone is centered but the tick mark is in right most. – sofs1 Sep 26 '16 at 08:55
  • @AndiGeeky OP has posted a sample pic here https://raw.githubusercontent.com/pnc/IconButton/master/images/demo.png In this pic the search lens icon is also centered along with the text. He wants the tick mark in center in the similar way. – sofs1 Sep 26 '16 at 08:56
  • @user3705478, i don't thing it can be done, either u have user two view or go for a custom view like the shared image. – Reprator Sep 26 '16 at 09:26
  • Wow Google dev vertically stretch custom checkMark for CheckedTextView – Qamar Jan 11 '18 at 11:03
  • not giving same effect with drawable start. Text is slightly shifted – Shubham AgaRwal Aug 22 '18 at 09:19