gpt4 book ai didi

java - 设置安卓:foreground View borderless

转载 作者:行者123 更新时间:2023-12-01 16:34:43 26 4
gpt4 key购买 nike

Android开发中如何设置按钮的android:foregrounddrawable为无边框?就像 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com