2

I have a button , inside which there is an image and text I used shape.xml to give css to button

enter image description here

How can i give css (stroke/border) to the image inside this button

enter image description here

the image is given as drawableTop inside the

Code:

<Button
            android:layout_margin="8dp"
            android:onClick="CollegeNews"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:drawableTop="@drawable/doctor"
            android:drawablePadding="30dp"
            android:drawableBackground="#95a5a6"
            android:padding="15dp"
            android:gravity="center"
            android:text="Doctor"
            android:background="@drawable/shape"
            />

Shape.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#FFF"
    />

<corners
    android:bottomLeftRadius="2dp"
    android:bottomRightRadius="2dp"
    android:topLeftRadius="2dp"
    android:topRightRadius="2dp" />

Thanks

djsreeraj
  • 639
  • 5
  • 14
  • Possible duplicate of [Border in shape xml](https://stackoverflow.com/questions/6698927/border-in-shape-xml) – Rashid Jul 14 '17 at 01:57
  • its about external border of shape, i want border for internal elements in shape – djsreeraj Jul 14 '17 at 01:59
  • did you try adding stroke on your shape? – Rashid Jul 14 '17 at 02:04
  • yes, its giving border outside the white – djsreeraj Jul 14 '17 at 02:06
  • I want stroke just of the image, not for whole box – djsreeraj Jul 14 '17 at 02:06
  • as what my understanding the drawableTop you add is an image file right? in order to customized it make it like shape then add the image as background like this https://stackoverflow.com/a/14377429/5870896 – Rashid Jul 14 '17 at 02:10
  • as what my understanding the drawableTop you add is an image file right? in order to customized it make it like shape then add the image as background like this https://stackoverflow.com/a/14377429/5870896 – Rashid Jul 14 '17 at 02:10

0 Answers0