Issue
I created a dialog and there is a button.
I want different style of button. So I made this file and applied to the background attribute of the button.
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/my_pink_color">
<item
android:id="@android:id/background"
android:drawable="@drawable/btn_line_border_dialogue"></item>
</ripple>
I don't know why it has shadow around the button. It has two buttons. And the second button doesn't have any thing. When I remove the second button, the shadow seems gone.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal"
android:orientation="vertical">
<Button
android:id="@+id/btn_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:clickable="true"
android:background="@drawable/btn_ripple"
android:text="Close"
android:textAllCaps="false"
android:textColor="@color/my_text_color"
android:textSize="17sp"
android:textStyle="bold" />
<Button
android:id="@+id/btn_close2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/btn_ripple"
android:clickable="true"
android:text="Don't show this in 24hours"
android:textAllCaps="false"
android:textColor="@color/my_text_color"
android:textSize="14sp"
android:textStyle="bold" />
</LinearLayout>
When I just apply btn_line_border_dialogue.xml
without the ripple. It is the same.
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/my_yellow" />
<stroke
android:width="1dp"
android:color="@color/my_pink" />
</shape>
How can I remove this effect?
Solution
Use style="?android:attr/borderlessButtonStyle"
inside your Button
refer : https://developer.android.com/guide/topics/ui/controls/button.html#Borderless
Or If you don't need Button
particularly, use TextView
instead
Answered By - Astha Garg
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.