How Can I Develop This Kind Of Button
This button has outer white rong and an inner grey background. The inner background contains an image (tickmark) and a text (Apply). I am able to make a shape like this (below).
Solution 1:
What I would do is something like this:
1 - Separate your LayerList into 2 distinct drawables
circle.xml
<?xml version="1.0" encoding="utf-8"?><shapexmlns:android="http://schemas.android.com/apk/res/android"android:shape="oval"
><sizeandroid:height="85dp"android:width="90dp" /><solidandroid:color="@color/grey" /><strokeandroid:color="@color/white"android:width="4dp" /></shape>
I assume you already have this bitmap: drawable/checkmark_filled
2 - Use a TextView, instead of an ImageView:
<TextView
android:id="@+id/button_apply"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:backgound="@drawable/button"
android:drawableTop="drawable/checkmark_filled"
android:text="APPLY"
android:clickable="true"
/>
Adjust the gravity and the paddings as needed. Also set some other properties as needed.
Note that you can (and should) use a string resource, instead of a hard-coded text.
Brief explanation:
- I'm using the oval shape as the TextView brackground.
- I'm using the checkmark bitmap as a compound drawable.
- I'm using the TextView's text to write something.
- I set the TextView as
clickable
, so you can use it as if it was a Button.
Post a Comment for "How Can I Develop This Kind Of Button"