Question

I try to reproduce a button like this :

enter image description here

There is a gray background with a bottom border in other gray.

I don't how to add this fine bottom border. Here is my result now :

enter image description here

Here is the code of my button :

   <Button
        android:id="@+id/button_consulter_original"
        style="?android:attr/borderlessButtonStyle"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="20dp"
        android:layout_marginLeft="50dp"
        android:layout_marginRight="50dp"
        android:layout_marginTop="10dp"
        android:background="@drawable/button_custom"
        android:text="@string/detail_article_view_consulter_sur_web"
        android:textColor="@color/blanc" />

and the code of button_custom.xml :

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@color/bleuactionbarFonce"
          android:state_pressed="true" />
    <item android:drawable="@color/bleuHome"
          android:state_focused="true" />
    <item android:drawable="@color/gray" />
</selector>
Was it helpful?

Solution

Add this view below your Button

 <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="@android:color/darker_gray" />

this will add the border effect,

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top