Android开发中如何设置按钮的android:foreground
drawable为无边框?就像 android:background="?android:attr/selectableItemBackgroundBorderless"
的情况一样。
最佳答案
你可以使用多种方法
1. android:background="@android:color/transparent"
2. android:background="?android:attr/selectableItemBackground"
3. style="?android:attr/borderlessButtonStyle"
或
4. android:background="@drawable/btn_borderless"
在第四种方法中,您将需要在可绘制文件夹中添加一个 xml 文件 btn_borderless,例如
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
</shape>
我从 https://inducesmile.com/android-programming/how-to-create-borderless-button-in-android/ 得到了这个答案
您的问题可能与 How to create borderless button using style from style.xml file (along with all other styles) 重复
关于java - 设置安卓:foreground View borderless,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61984979/