优化:统一管理自定义模板可用变量标签插入按钮 #559

This commit is contained in:
pppscn 2024-11-21 09:44:22 +08:00
parent 0a3f9f53f1
commit 2a910fe504
2 changed files with 21 additions and 1 deletions

View File

@ -382,7 +382,7 @@ class CommonUtils private constructor() {
// 遍历所有按钮数据,过滤掉需要排除的按钮 // 遍历所有按钮数据,过滤掉需要排除的按钮
allButtons.forEach { (tag, lable) -> allButtons.forEach { (tag, lable) ->
if (excludeSet.isNotEmpty() && excludeSet.contains(tag)) { if (excludeSet.isNotEmpty() && excludeSet.contains(tag)) {
allButtons.remove(tag) return@forEach
} }
val button = TextView(context).apply { val button = TextView(context).apply {

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 按下时的背景 -->
<item android:state_pressed="true">
<shape>
<solid android:color="#1E88E5" /> <!-- 按下时的深蓝背景色 -->
<corners android:radius="3dp" /> <!-- 圆角半径 -->
<stroke android:width="1dp" android:color="#1565C0" /> <!-- 边框深蓝色 -->
</shape>
</item>
<!-- 默认背景 -->
<item>
<shape>
<solid android:color="#2196F3" /> <!-- 默认浅蓝背景色 -->
<corners android:radius="3dp" /> <!-- 圆角半径 -->
<stroke android:width="1dp" android:color="#1E88E5" /> <!-- 边框蓝色 -->
</shape>
</item>
</selector>