center text and checkmark of CheckedTextView
Asked Answered
E

1

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..!!

Eure answered 21/10, 2015 at 4:57 Comment(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 thisEure
A
54

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..!!

Archives answered 21/10, 2015 at 5:29 Comment(12)
Thanks @AndiGeeky, your answer is very helpful to me...can you please align the checkmark alongwith textview....and thank you againEure
@ Vikram Singh : Did not get your point .. Will you please explain more..!!Archives
i just want to align the checkmark along with text like done in this application( 2 Image) github.com/pnc/IconButtonEure
@ Vikram Singh : Please add image url..!Archives
here is the image url,github.com/pnc/IconButton/blob/master/images/demo.png?raw=trueEure
@VikramSingh Did you find the solution?Speechless
@VikramSingh: I have not tried yet. Can you please add question with more details and send me link?Archives
@Archives 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.Speechless
@Archives OP has posted a sample pic here 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.Speechless
@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.Eure
Wow Google dev vertically stretch custom checkMark for CheckedTextViewEmbrasure
not giving same effect with drawable start. Text is slightly shiftedAcantho

© 2022 - 2024 — McMap. All rights reserved.