Aiyan Hamid
Aiyan Hamid

Reputation: 1

Set android:foreground View borderless

How to set android:foreground drawable of a button borderless in Android development? Like in case of android:background="?android:attr/selectableItemBackgroundBorderless".

Upvotes: 0

Views: 380

Answers (1)

Prathamesh
Prathamesh

Reputation: 1057

Well you can use multiple approches

1. android:background="@android:color/transparent"

2. android:background="?android:attr/selectableItemBackground"

3. style="?android:attr/borderlessButtonStyle"

or

4. android:background="@drawable/btn_borderless" 

in 4th approch you will require a xml file btn_borderless in your drawable folder such as

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
</shape>

I got this answer from https://inducesmile.com/android-programming/how-to-create-borderless-button-in-android/

and your question may be possible duplicate of How to create borderless button using style from style.xml file (along with all other styles)

Upvotes: 1

Related Questions