android - 更改具有透明背景的圆形按钮的颜色
问题描述
如何更改圆角文本视图或具有透明背景的按钮的颜色,像这样
我希望再次单击按钮时取消选择,而不仅仅是选择
解决方案
在可绘制文件夹 bg.xml 中添加 xml 文件
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="10dp">
<!-- you can use any color you want I used here gray color-->
<stroke
android:height="1.0dip"
android:width="1.0dip"
android:color="#ffee82ee" />
<solid android:color="@android:color/transparent"/>
<corners android:radius="7dp"/>
</shape>
并在布局
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg"
android:textColor="#ffee82ee"/>
它会工作..
推荐阅读
- visual-studio - 对 Visual Studio 的更新还更新了 .csproj 和 .sln 文件。我应该检查这两个更改的文件吗
- android-studio - Android Studio 中关于 Spinners 和 `clickable` 属性的明确错误?
- flutter - 是否可以在文本和下划线之间有一定高度的文本下划线?
- spartacus-storefront - 自定义某些似乎不可覆盖的 cmsComponents
- mongodb - 只允许在内部服务调用上创建多个条目
- android - Here maps Premium SDK 中的渲染问题
- python - 如何在 TkInter 的函数中设置我的文本的字体大小和字体?
- java - 我有比 CopyOnWriteArrayList 和 Collections.synchronizedList 更好的选择吗?
- c# - C# Activator.CreateInstance 抽象类找不到构造函数
- python - 我正在尝试从 html 页面中检索当前页码,以便在 update_table 函数上针对分页进行 url 路由