0

I am trying to implement button in android with following layout.How to make it??

enter image description here

i have already implemented button like this

enter image description here

i used following code to make

<TextView
              android:id="@+id/action_text_share"
                            style="@style/mediumTextSize"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="5dip"
                            android:gravity="center"
                            android:singleLine="false"
                            android:text="Share by Text"
                            android:padding="10dp"
                            android:layout_weight="1"
                             android:background="@drawable/white_broder_round_with_transparent_bg"
                            android:textColor="@color/blackColor" />

and have drawable like this

<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="@color/removeContactRedColor"/>
    <stroke android:width="2dip" android:color="@color/removeContactRedColor" />
    <corners 
       android:radius="5dip"
        />
</shape>
DevThapa
  • 173
  • 2
  • 12
  • 2
    I really do not understand the question. If you've already made a button that looks the same, but just needs different text, surely you can make the next one? – Ewald Sep 21 '15 at 08:58
  • 1
    Maybe you want make the corners of a button round. Please check this link: http://stackoverflow.com/questions/6054562/how-to-make-the-corners-of-a-button-round – Hong Thai Sep 21 '15 at 08:58
  • What you have tried so far? can you please show us your code? – pcs Sep 21 '15 at 08:58
  • 1
    set background image with text this is simple formate else hard to manage it will not manage by style code or this can not manage by style – Amitsharma Sep 21 '15 at 08:59
  • 1
    you can write a drawable xml with what you want and set the background for the button – Sree Sep 21 '15 at 09:04
  • i want to add dis-continuous white border instead of full white border. – DevThapa Sep 21 '15 at 09:04

3 Answers3

1

You can do like this in drawable, <item android:right="-2dp"> will remove stroke from the right end.

 <item android:right="-2dp">
    <shape>
        <corners android:radius="4dp"/>
        <solid android:color="@android:color/transparent" />
        <stroke
            android:width="1dp"
            android:color="@color/app_white" />
    </shape>
</item>
Ankii Rawat
  • 2,070
  • 17
  • 17
0

Some suggestions:

  1. Create a drawable image of the background and use this one as background.
  2. Assuming you created this with xml, create a solid blue shape and place it over the circle.
Robin Dijkhof
  • 18,665
  • 11
  • 65
  • 116
0

Design a Background Image and Set it to Button with correct Padding and Margin

enter image description here

Set Text with The Background of Similar Above Image according to your Need

Rajan Kali
  • 12,627
  • 3
  • 25
  • 37