-7

In my application i want to insert the Button(like button) but i want to create the button using XML Styles.I want the button something like this:
enter image description here

Any idea ?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Raj kumar
  • 153
  • 4
  • 13

3 Answers3

4

You can find in vector assets. Thumb up icon.

 <vector xmlns:android="http://schemas.android.com/apk/res/android"
            android:width="24dp"
            android:height="24dp"
            android:viewportWidth="24.0"
            android:viewportHeight="24.0">
        <path
            android:fillColor="#1B8FFB"
            android:pathData="M1,21h4L5,9L1,9v12zM23,10c0,-1.1 -0.9,-2 -2,-2h-6.31l0.95,-4.57 0.03,-0.32c0,-0.41 -0.17,-0.79 -0.44,-1.06L14.17,1 7.59,7.59C7.22,7.95 7,8.45 7,9v10c0,1.1 0.9,2 2,2h9c0.83,0 1.54,-0.5 1.84,-1.22l3.02,-7.05c0.09,-0.23 0.14,-0.47 0.14,-0.73v-1.91l-0.01,-0.01L23,10z"/>
 </vector>

Then use this way :

    <Button
            android:id="@+id/button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/ic_thumb_up_black_24dp"
      />
Vidhi Dave
  • 5,614
  • 2
  • 33
  • 55
3

Add this to your xml

<com.like.LikeButton
  app:icon_type="heart"
  app:icon_size="25dp"
  android:id="@+id/star_button"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"/>

Add this in your root build.gradle file (not your module build.gradle file):

allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}

Add this to your module's build.gradle file:

dependencies {
    ...
    compile 'com.github.jd-alexander:LikeButton:0.2.3'
    }
}

You can find the tutorial here https://github.com/jd-alexander/LikeButton

John Joe
  • 12,412
  • 16
  • 70
  • 135
1

Use ImageButton instead of the Button

<ImageButton
    android:id="@+id/imageButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:srcCompat="@drawable/icons8-Thumbs Up-48"
/>

you can use it, or visit for more details https://developer.android.com/reference/android/widget/ImageButton.html https://www.tutorialspoint.com/android/android_imagebutton_control.htm

John Joe
  • 12,412
  • 16
  • 70
  • 135