应用日志调试窗口第一工具栏调试完成。
This commit is contained in:
@@ -33,7 +33,7 @@ android {
|
|||||||
// versionName 更新后需要手动设置
|
// versionName 更新后需要手动设置
|
||||||
// .winboll/winbollBuildProps.properties 文件的 stageCount=0
|
// .winboll/winbollBuildProps.properties 文件的 stageCount=0
|
||||||
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
||||||
versionName "15.12"
|
versionName "15.14"
|
||||||
if(true) {
|
if(true) {
|
||||||
versionName = genVersionName("${versionName}")
|
versionName = genVersionName("${versionName}")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Mon Dec 15 03:47:52 GMT 2025
|
#Mon Dec 15 08:40:28 GMT 2025
|
||||||
stageCount=3
|
stageCount=0
|
||||||
libraryProject=libappbase
|
libraryProject=libappbase
|
||||||
baseVersion=15.12
|
baseVersion=15.14
|
||||||
publishVersion=15.12.2
|
publishVersion=15.14.0
|
||||||
buildCount=40
|
buildCount=105
|
||||||
baseBetaVersion=15.12.3
|
baseBetaVersion=15.14.1
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Mon Dec 15 03:47:52 GMT 2025
|
#Mon Dec 15 08:40:28 GMT 2025
|
||||||
stageCount=3
|
stageCount=0
|
||||||
libraryProject=libappbase
|
libraryProject=libappbase
|
||||||
baseVersion=15.12
|
baseVersion=15.14
|
||||||
publishVersion=15.12.2
|
publishVersion=15.14.0
|
||||||
buildCount=40
|
buildCount=105
|
||||||
baseBetaVersion=15.12.3
|
baseBetaVersion=15.14.1
|
||||||
|
|||||||
@@ -24,11 +24,11 @@ import android.widget.EditText;
|
|||||||
import android.widget.HorizontalScrollView;
|
import android.widget.HorizontalScrollView;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
import android.widget.Spinner;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
import cc.winboll.studio.libappbase.R;
|
import cc.winboll.studio.libappbase.R;
|
||||||
import cc.winboll.studio.libappbase.views.HorizontalListView;
|
import cc.winboll.studio.libappbase.views.HorizontalListView;
|
||||||
|
import cc.winboll.studio.libappbase.widget.LogTagSpinner;
|
||||||
import java.text.Collator;
|
import java.text.Collator;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -52,7 +52,7 @@ public class LogView extends RelativeLayout {
|
|||||||
TAGListAdapter mTAGListAdapter;
|
TAGListAdapter mTAGListAdapter;
|
||||||
LogViewThread mLogViewThread;
|
LogViewThread mLogViewThread;
|
||||||
LogViewHandler mLogViewHandler;
|
LogViewHandler mLogViewHandler;
|
||||||
Spinner mLogLevelSpinner;
|
LogTagSpinner mLogLevelSpinner;
|
||||||
ArrayAdapter<CharSequence> mLogLevelSpinnerAdapter;
|
ArrayAdapter<CharSequence> mLogLevelSpinnerAdapter;
|
||||||
// 标签列表
|
// 标签列表
|
||||||
HorizontalListView mListViewTags;
|
HorizontalListView mListViewTags;
|
||||||
@@ -115,7 +115,7 @@ public class LogView extends RelativeLayout {
|
|||||||
metTagSearch = findViewById(cc.winboll.studio.libappbase.R.id.tagsearch_et);
|
metTagSearch = findViewById(cc.winboll.studio.libappbase.R.id.tagsearch_et);
|
||||||
// 获取Log Level spinner实例
|
// 获取Log Level spinner实例
|
||||||
mLogLevelSpinner = findViewById(cc.winboll.studio.libappbase.R.id.viewlogSpinner1);
|
mLogLevelSpinner = findViewById(cc.winboll.studio.libappbase.R.id.viewlogSpinner1);
|
||||||
|
|
||||||
metTagSearch.addTextChangedListener(new TextWatcher() {
|
metTagSearch.addTextChangedListener(new TextWatcher() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -178,20 +178,25 @@ public class LogView extends RelativeLayout {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 设置日志级别列表
|
// 设置日志级别列表
|
||||||
ArrayList<String> adapterItems = new ArrayList<>();
|
// ArrayList<String> adapterItems = new ArrayList<>();
|
||||||
for (LogUtils.LOG_LEVEL e : LogUtils.LOG_LEVEL.values()) {
|
// for (LogUtils.LOG_LEVEL e : LogUtils.LOG_LEVEL.values()) {
|
||||||
adapterItems.add(e.name());
|
// adapterItems.add(e.name());
|
||||||
}
|
// }
|
||||||
|
String[] mLogLevelSpinnerData = new String[LogUtils.LOG_LEVEL.values().length];
|
||||||
|
for (int i = 0; i < LogUtils.LOG_LEVEL.values().length; i++) {
|
||||||
|
mLogLevelSpinnerData[i] = LogUtils.LOG_LEVEL.values()[i].name();
|
||||||
|
}
|
||||||
|
mLogLevelSpinner.setLogTagData(mLogLevelSpinnerData);
|
||||||
// 假设你有一个字符串数组作为选项列表
|
// 假设你有一个字符串数组作为选项列表
|
||||||
//String[] options = {"Option 1", "Option 2", "Option 3"};
|
//String[] options = {"Option 1", "Option 2", "Option 3"};
|
||||||
// 创建一个ArrayAdapter来绑定数据到spinner
|
// 创建一个ArrayAdapter来绑定数据到spinner
|
||||||
mLogLevelSpinnerAdapter = ArrayAdapter.createFromResource(
|
// mLogLevelSpinnerAdapter = ArrayAdapter.createFromResource(
|
||||||
context, cc.winboll.studio.libappbase.R.array.enum_loglevel_array, android.R.layout.simple_spinner_item);
|
// context, cc.winboll.studio.libappbase.R.array.enum_loglevel_array, android.R.layout.simple_spinner_item);
|
||||||
mLogLevelSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
// mLogLevelSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
|
||||||
// 设置适配器并将它应用到spinner上
|
// // 设置适配器并将它应用到spinner上
|
||||||
mLogLevelSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // 设置下拉视图样式
|
// mLogLevelSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // 设置下拉视图样式
|
||||||
mLogLevelSpinner.setAdapter(mLogLevelSpinnerAdapter);
|
// mLogLevelSpinner.setAdapter(mLogLevelSpinnerAdapter);
|
||||||
// 为Spinner添加监听器
|
// 为Spinner添加监听器
|
||||||
mLogLevelSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
mLogLevelSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -247,6 +252,8 @@ public class LogView extends RelativeLayout {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
mLogLevelSpinner.updateTextSize(R.dimen.log_spinner_text_size);
|
||||||
|
|
||||||
// 设置滚动时不聚焦日志
|
// 设置滚动时不聚焦日志
|
||||||
setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
|
setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,248 @@
|
|||||||
|
package cc.winboll.studio.libappbase.widget;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.util.TypedValue;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.Spinner;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
|
import cc.winboll.studio.libappbase.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ZhanGSKen&豆包大模型<zhangsken@qq.com>
|
||||||
|
* @Date 2025/12/15 13:51
|
||||||
|
* @Describe 纯原生 LogTag 专属 Spinner(无 androidx 依赖)
|
||||||
|
* 核心特性:1. 继承原生 Spinner,适配全 Android 版本;2. dimen 统一配置所有尺寸;3. 文字大小支持 dp 单位;4. 简化外部初始化
|
||||||
|
*/
|
||||||
|
public class LogTagSpinner extends Spinner {
|
||||||
|
public static final String TAG = "LogTagSpinner";
|
||||||
|
|
||||||
|
Context mContext;
|
||||||
|
// 尺寸缓存(dimen 解析后转 px,避免重复计算)
|
||||||
|
private int mSpinnerWidth; // 控件自身框度(px)
|
||||||
|
private int mSpinnerHeight; // 控件自身高度(px)
|
||||||
|
private int mItemWidth; // 下拉项单个高度(px)
|
||||||
|
private int mItemHeight; // 下拉项单个高度(px)
|
||||||
|
private float mTextSizePx; // 文字大小(px,dp 转译后)
|
||||||
|
private int mTextPadding; // 文字左右内边距(px)
|
||||||
|
|
||||||
|
// 内置适配器(外部无需关心内部实现)
|
||||||
|
private ArrayAdapter<String> mLogTagAdapter;
|
||||||
|
|
||||||
|
|
||||||
|
// -------------------------- 构造方法(原生 Spinner 必重写 3 个)--------------------------
|
||||||
|
public LogTagSpinner(Context context) {
|
||||||
|
super(context);
|
||||||
|
initCoreLogic(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LogTagSpinner(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
initCoreLogic(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LogTagSpinner(Context context, AttributeSet attrs, int defStyle) {
|
||||||
|
super(context, attrs, defStyle);
|
||||||
|
initCoreLogic(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------- 核心初始化(解析资源 + 配置样式 + 初始化适配器)--------------------------
|
||||||
|
private void initCoreLogic(Context context) {
|
||||||
|
this.mContext = context;
|
||||||
|
// 1. 读取 dimen 资源(dp 转 px,核心适配)
|
||||||
|
parseDimenResources();
|
||||||
|
// 2. 设置 Spinner 自身基础样式(高度、背景)
|
||||||
|
configSelfStyle();
|
||||||
|
// 3. 初始化适配器(统一选中项+下拉项样式)
|
||||||
|
initCustomAdapter();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 步骤 1:解析 dimen 资源,所有 dp 单位转为 px(跨设备视觉一致)
|
||||||
|
*/
|
||||||
|
private void parseDimenResources() {
|
||||||
|
Context context = this.mContext;
|
||||||
|
// 控件自身宽度(dp → px)
|
||||||
|
mSpinnerWidth = context.getResources().getDimensionPixelSize(R.dimen.log_spinner_width);
|
||||||
|
// 控件自身高度(dp → px)
|
||||||
|
mSpinnerHeight = context.getResources().getDimensionPixelSize(R.dimen.log_spinner_height);
|
||||||
|
// 下拉项宽度(dp → px)
|
||||||
|
mItemWidth = context.getResources().getDimensionPixelSize(R.dimen.log_spinner_item_width);
|
||||||
|
// 下拉项高度(dp → px)
|
||||||
|
mItemHeight = context.getResources().getDimensionPixelSize(R.dimen.log_spinner_item_height);
|
||||||
|
// 文字大小(dp → px,核心:用 getDimensionPixelSize 确保 dp 精准转译)
|
||||||
|
mTextSizePx = context.getResources().getDimensionPixelSize(R.dimen.log_spinner_text_size);
|
||||||
|
// 文字内边距(dp → px)
|
||||||
|
mTextPadding = context.getResources().getDimensionPixelSize(R.dimen.log_spinner_text_padding);
|
||||||
|
|
||||||
|
LogUtils.d("LogTagSpinner", "dimen 解析完成:高度=" + mSpinnerHeight + "px,文字大小=" + mTextSizePx + "px");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 步骤 2:配置 Spinner 自身样式(覆盖布局属性,统一控制)
|
||||||
|
*/
|
||||||
|
private void configSelfStyle() {
|
||||||
|
// 动态设置控件高度(布局中 layout_height 设 wrap_content 即可,这里统一控制)
|
||||||
|
ViewGroup.LayoutParams layoutParams = getLayoutParams();
|
||||||
|
if (layoutParams != null) {
|
||||||
|
layoutParams.width = mSpinnerWidth;
|
||||||
|
layoutParams.height = mSpinnerHeight;
|
||||||
|
} else {
|
||||||
|
// 代码创建控件时,手动初始化布局参数
|
||||||
|
layoutParams = new ViewGroup.LayoutParams(
|
||||||
|
mSpinnerWidth,
|
||||||
|
mSpinnerHeight
|
||||||
|
);
|
||||||
|
}
|
||||||
|
setLayoutParams(layoutParams);
|
||||||
|
|
||||||
|
// 统一背景色(外部可通过 setBackground 手动覆盖)
|
||||||
|
setBackgroundColor(this.mContext.getColor(R.color.btn_gray_normal));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 步骤 3:初始化自定义适配器,统一选中项+下拉项样式
|
||||||
|
*/
|
||||||
|
private void initCustomAdapter() {
|
||||||
|
// 用原生系统布局(避免自定义布局,减少依赖),后续重写样式
|
||||||
|
mLogTagAdapter = new ArrayAdapter<String>(this.mContext, android.R.layout.simple_spinner_item) {
|
||||||
|
// 重写:控制「已选中项」的样式(文字大小、高度、内边距)
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
TextView itemTv = (TextView) super.getView(position, convertView, parent);
|
||||||
|
setItemUniformStyle(itemTv);
|
||||||
|
return itemTv;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重写:控制「下拉列表项」的样式(必须重写,否则下拉项样式不生效)
|
||||||
|
@Override
|
||||||
|
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
||||||
|
TextView itemTv = (TextView) super.getDropDownView(position, convertView, parent);
|
||||||
|
setItemUniformStyle(itemTv);
|
||||||
|
return itemTv;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 绑定下拉项布局(原生系统布局,确保低版本兼容)
|
||||||
|
mLogTagAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
// 设置适配器到 Spinner
|
||||||
|
setAdapter(mLogTagAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用方法:统一设置列表项(选中项/下拉项)的样式
|
||||||
|
*/
|
||||||
|
private void setItemUniformStyle(TextView itemTv) {
|
||||||
|
if (itemTv == null) return;
|
||||||
|
|
||||||
|
// 1. 文字大小(核心:按 px 赋值,dp 转译后无二次换算,精准适配)
|
||||||
|
itemTv.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextSizePx);
|
||||||
|
// 2. 列表项高度(固定高度,避免文字多少导致高度不一致)
|
||||||
|
itemTv.setWidth(mItemWidth);
|
||||||
|
itemTv.setHeight(mItemHeight);
|
||||||
|
// 3. 内边距(左右留白,优化排版,避免文字贴边)
|
||||||
|
itemTv.setPadding(mTextPadding, 0, mTextPadding, 0);
|
||||||
|
// 4. 文字对齐(垂直居中+靠左,符合常规 UI 设计)
|
||||||
|
//itemTv.setGravity(View.GRAVITY_CENTER_VERTICAL | View.GRAVITY_START);
|
||||||
|
// 5. 文字颜色(统一深色,可改为项目颜色资源)
|
||||||
|
itemTv.setTextColor(this.mContext.getColor(R.color.white));
|
||||||
|
itemTv.setBackgroundColor(this.mContext.getColor(R.color.btn_gray_normal));
|
||||||
|
// 6. 文字溢出处理(最多 2 行,超出省略,避免长标签换行过多)
|
||||||
|
itemTv.setSingleLine(false);
|
||||||
|
itemTv.setMaxLines(2);
|
||||||
|
itemTv.setEllipsize(TextUtils.TruncateAt.END);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -------------------------- 外部调用 API(极简用法,无需关心内部逻辑)--------------------------
|
||||||
|
/**
|
||||||
|
* 填充日志标签数据(外部核心调用,一行代码搞定)
|
||||||
|
* @param logTagArray 日志标签数组(如:{"TAG_MAIN", "TAG_NET", "TAG_DB"})
|
||||||
|
*/
|
||||||
|
public void setLogTagData(String[] logTagArray) {
|
||||||
|
if (mLogTagAdapter == null || logTagArray == null || logTagArray.length == 0) {
|
||||||
|
LogUtils.w("LogTagSpinner", "填充数据失败:适配器为空或数据无效");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 清空旧数据,添加新数据,刷新适配器
|
||||||
|
mLogTagAdapter.clear();
|
||||||
|
mLogTagAdapter.addAll(logTagArray);
|
||||||
|
mLogTagAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置默认选中的标签(索引从 0 开始)
|
||||||
|
* @param defaultIndex 默认选中索引(需在 setLogTagData 之后调用)
|
||||||
|
*/
|
||||||
|
public void setDefaultSelectedTag(int defaultIndex) {
|
||||||
|
if (mLogTagAdapter == null) return;
|
||||||
|
// 索引合法性校验,避免数组越界
|
||||||
|
if (defaultIndex >= 0 && defaultIndex < mLogTagAdapter.getCount()) {
|
||||||
|
setSelection(defaultIndex);
|
||||||
|
LogUtils.d("LogTagSpinner", "默认选中标签:" + mLogTagAdapter.getItem(defaultIndex));
|
||||||
|
} else {
|
||||||
|
LogUtils.w("LogTagSpinner", "默认选中索引无效:" + defaultIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前选中的日志标签(外部业务逻辑调用)
|
||||||
|
* @return 当前选中的标签文字(无选中时返回空字符串)
|
||||||
|
*/
|
||||||
|
public String getCurrentSelectedTag() {
|
||||||
|
Object selectedItem = getSelectedItem();
|
||||||
|
return selectedItem != null ? selectedItem.toString() : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -------------------------- 优化扩展(可选,提升稳定性)--------------------------
|
||||||
|
/**
|
||||||
|
* 视图附着到窗口时,确保默认有数据(避免空指针)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void onAttachedToWindow() {
|
||||||
|
super.onAttachedToWindow();
|
||||||
|
if (mLogTagAdapter != null && mLogTagAdapter.getCount() == 0) {
|
||||||
|
setLogTagData(new String[]{"默认标签"});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 外部扩展:动态修改文字大小(dp 单位)
|
||||||
|
* @param textSizeDp 目标文字大小(dp)
|
||||||
|
*/
|
||||||
|
public void updateTextSize(int textSizeDp) {
|
||||||
|
mTextSizePx = this.mContext.getResources().getDimensionPixelSize(textSizeDp);
|
||||||
|
// 刷新所有列表项样式
|
||||||
|
if (mLogTagAdapter != null) {
|
||||||
|
mLogTagAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 外部扩展:动态修改文字颜色
|
||||||
|
* @param textColorRes 文字颜色资源 ID(如 R.color.red)
|
||||||
|
*/
|
||||||
|
public void updateTextColor(int textColorRes) {
|
||||||
|
int textColor = this.mContext.getResources().getColor(textColorRes);
|
||||||
|
// 刷新选中项颜色
|
||||||
|
TextView selectedTv = (TextView) getSelectedView();
|
||||||
|
if (selectedTv != null) {
|
||||||
|
selectedTv.setTextColor(textColor);
|
||||||
|
}
|
||||||
|
// 刷新下拉项颜色
|
||||||
|
if (mLogTagAdapter != null) {
|
||||||
|
mLogTagAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
14
libappbase/src/main/res/drawable/btn_gray_bg.xml
Normal file
14
libappbase/src/main/res/drawable/btn_gray_bg.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- 按钮状态选择器:按优先级匹配(按压 > 禁用 > 默认) -->
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<!-- 状态 1:按压时(手指按住)→ 深灰色 -->
|
||||||
|
<item android:color="@color/btn_gray_pressed" android:state_pressed="true"/>
|
||||||
|
|
||||||
|
<!-- 状态 2:禁用时(setEnabled(false))→ 浅灰色 -->
|
||||||
|
<item android:color="@color/btn_gray_disabled" android:state_enabled="false"/>
|
||||||
|
|
||||||
|
<!-- 状态 3:默认态(正常可点击)→ 常规灰色 -->
|
||||||
|
<item android:color="@color/btn_gray_normal"/>
|
||||||
|
|
||||||
|
</selector>
|
||||||
@@ -9,55 +9,60 @@
|
|||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="40dp"
|
android:layout_height="34dp"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:background="@drawable/bg_toolbar_log"
|
android:background="@drawable/bg_toolbar_log"
|
||||||
android:id="@+id/viewlogRelativeLayoutToolbar">
|
android:id="@+id/viewlogRelativeLayoutToolbar">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="@dimen/log_button_width"
|
||||||
android:layout_height="@dimen/log_button_height"
|
android:layout_height="@dimen/log_button_height"
|
||||||
android:textSize="@dimen/log_text_size"
|
android:textSize="@dimen/log_text_size"
|
||||||
android:text="Clean"
|
android:text="Clean"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:backgroundTint="@drawable/btn_gray_bg"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:id="@+id/viewlogButtonClean"
|
android:id="@+id/viewlogButtonClean"
|
||||||
android:layout_marginLeft="5dp"/>
|
android:layout_marginLeft="5dp"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:background="#FF000000"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="@dimen/log_button_height"
|
android:layout_height="20dp"
|
||||||
android:textSize="@dimen/log_text_size"
|
android:textSize="@dimen/log_text_size"
|
||||||
|
android:padding="@dimen/log_text_padding"
|
||||||
android:text="LV:"
|
android:text="LV:"
|
||||||
android:layout_toRightOf="@+id/viewlogButtonClean"
|
android:layout_toRightOf="@+id/viewlogButtonClean"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:id="@+id/viewlogTextView1"
|
android:id="@+id/viewlogTextView1"
|
||||||
android:textColor="#FFFFFFFF"/>
|
android:background="@color/btn_gray_normal"
|
||||||
|
android:textColor="@color/black"/>
|
||||||
|
|
||||||
<Spinner
|
<cc.winboll.studio.libappbase.widget.LogTagSpinner
|
||||||
android:background="#FFFFFFFF"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_toRightOf="@+id/viewlogTextView1"
|
android:layout_toRightOf="@+id/viewlogTextView1"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:id="@+id/viewlogSpinner1"
|
android:id="@+id/viewlogSpinner1"
|
||||||
style="@style/LogActivitySpinnerStyle"/>
|
android:padding="@dimen/log_spinner_text_padding"/>
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="@dimen/log_checkbox_width"
|
||||||
android:layout_height="@dimen/log_button_height"
|
android:layout_height="@dimen/log_checkbox_height"
|
||||||
android:textSize="@dimen/log_text_size"
|
android:textSize="@dimen/log_text_size"
|
||||||
android:layout_toLeftOf="@+id/viewlogButtonCopy"
|
android:layout_toLeftOf="@+id/viewlogButtonCopy"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:text="Selectable"
|
android:text="Selectable"
|
||||||
android:background="#FFFFFFFF"
|
android:background="@color/btn_gray_normal"
|
||||||
android:paddingRight="10dp"
|
android:id="@+id/viewlogCheckBoxSelectable"
|
||||||
android:id="@+id/viewlogCheckBoxSelectable"/>
|
android:padding="@dimen/log_text_padding"
|
||||||
|
android:textColor="@color/white"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="@dimen/log_button_width"
|
||||||
android:layout_height="@dimen/log_button_height"
|
android:layout_height="@dimen/log_button_height"
|
||||||
android:textSize="@dimen/log_text_size"
|
android:textSize="@dimen/log_text_size"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:backgroundTint="@drawable/btn_gray_bg"
|
||||||
android:text="Copy"
|
android:text="Copy"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
|
|||||||
@@ -5,4 +5,70 @@
|
|||||||
<color name="colorAccent">#FF8DFFA2</color>
|
<color name="colorAccent">#FF8DFFA2</color>
|
||||||
<color name="colorText">#FFFFFB8D</color>
|
<color name="colorText">#FFFFFB8D</color>
|
||||||
<color name="colorTextBackgound">#FF000000</color>
|
<color name="colorTextBackgound">#FF000000</color>
|
||||||
|
|
||||||
|
<!-- ============== 基础黑白(必含,适配文字/背景) ============== -->
|
||||||
|
<color name="white">#FFFFFF</color> <!-- 纯白色(文字/背景) -->
|
||||||
|
<color name="black">#000000</color> <!-- 近黑色(重要文字) -->
|
||||||
|
|
||||||
|
<!-- ============== 基础色系(按钮/强调色常用) ============== -->
|
||||||
|
<!-- 蓝色系(常用:确认/链接/主题色) -->
|
||||||
|
<color name="blue_light">#4A90E2</color> <!-- 浅蓝(次要按钮) -->
|
||||||
|
<color name="blue_normal">#2196F3</color> <!-- 标准蓝(主题/确认按钮) -->
|
||||||
|
<color name="blue_dark">#1976D2</color> <!-- 深蓝(按压态/重要强调) -->
|
||||||
|
<!-- 绿色系(常用:成功/完成/安全提示) -->
|
||||||
|
<color name="green_light">#66BB6A</color> <!-- 浅绿(次要成功态) -->
|
||||||
|
<color name="green_normal">#4CAF50</color> <!-- 标准绿(成功按钮/提示) -->
|
||||||
|
<color name="green_dark">#388E3C</color> <!-- 深绿(按压态/重要成功) -->
|
||||||
|
<!-- 红色系(常用:错误/警告/删除按钮) -->
|
||||||
|
<color name="red_light">#EF5350</color> <!-- 浅红(次要错误提示) -->
|
||||||
|
<color name="red_normal">#F44336</color> <!-- 标准红(删除/错误按钮) -->
|
||||||
|
<color name="red_dark">#D32F2F</color> <!-- 深红(按压态/重要错误) -->
|
||||||
|
<!-- 黄色系(常用:警告/提醒/高亮) -->
|
||||||
|
<color name="yellow_light">#FFF59D</color> <!-- 浅黄(次要提醒) -->
|
||||||
|
<color name="yellow_normal">#FFC107</color> <!-- 标准黄(警告提示/高亮) -->
|
||||||
|
<color name="yellow_dark">#FFA000</color> <!-- 深黄(重要警告) -->
|
||||||
|
<!-- 橙色系(常用:提醒/进度/活力色) -->
|
||||||
|
<color name="orange_normal">#FF9800</color> <!-- 标准橙(提醒按钮/进度) -->
|
||||||
|
<!-- 紫色系(常用:特殊强调/个性按钮) -->
|
||||||
|
<color name="purple_normal">#9C27B0</color> <!-- 标准紫(特殊功能按钮) -->
|
||||||
|
|
||||||
|
<!-- ============== 透明色(遮罩/背景叠加) ============== -->
|
||||||
|
<color name="transparent">#00000000</color> <!-- 全透明 -->
|
||||||
|
<color name="black_transparent_50">#80000000</color> <!-- 50%透明黑(遮罩) -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 1. 不透明灰色(常用深浅梯度,直接用) -->
|
||||||
|
<color name="gray_100">#F5F5F5</color> <!-- 极浅灰(接近白色,背景用) -->
|
||||||
|
<color name="gray_200">#EEEEEE</color> <!-- 浅灰(卡片/分割线背景) -->
|
||||||
|
<color name="gray_300">#E0E0E0</color> <!-- 中浅灰(边框/次要背景) -->
|
||||||
|
<color name="gray_400">#BDBDBD</color> <!-- 中灰(次要文字/图标) -->
|
||||||
|
<color name="gray_500">#9E9E9E</color> <!-- 标准中灰(常用辅助文字) -->
|
||||||
|
<color name="gray_600">#757575</color> <!-- 中深灰(常规辅助文字) -->
|
||||||
|
<color name="gray_700">#616161</color> <!-- 深灰(重要辅助文字) -->
|
||||||
|
<color name="gray_800">#424242</color> <!-- 极深灰(接近黑色,标题副文本) -->
|
||||||
|
<color name="gray_900">#212121</color> <!-- 近黑色(特殊场景用) -->
|
||||||
|
|
||||||
|
<!-- 2. 半透明灰色(带透明度,遮罩/蒙层用) -->
|
||||||
|
<color name="gray_transparent_30">#4D9E9E9E</color> <!-- 30%透明中灰(A=4D) -->
|
||||||
|
<color name="gray_transparent_50">#809E9E9E</color> <!-- 50%透明中灰(A=80) -->
|
||||||
|
<color name="gray_transparent_70">#B39E9E9E</color> <!-- 70%透明中灰(A=B3) -->
|
||||||
|
|
||||||
|
<color name="gray_light">#EEE</color> <!-- 等价 #EEEEEE(浅灰) -->
|
||||||
|
<color name="gray_mid">#999</color> <!-- 等价 #999999(中灰) -->
|
||||||
|
<color name="gray_dark">#666</color> <!-- 等价 #666666(深灰) -->
|
||||||
|
<color name="gray_black">#333</color> <!-- 等价 #333333(极深灰) -->
|
||||||
|
|
||||||
|
<!-- 50% 透明中灰(弹窗遮罩常用) -->
|
||||||
|
<color name="mask_gray">#809E9E9E</color>
|
||||||
|
<!-- 30% 透明深灰(背景叠加) -->
|
||||||
|
<color name="bg_overlay_gray">#4D424242</color>
|
||||||
|
|
||||||
|
<!-- 1. 常规灰色(按钮默认态,常用中灰) -->
|
||||||
|
<color name="btn_gray_normal">#9E9E9E</color>
|
||||||
|
<!-- 2. 按压深色(按钮点击态,加深一级,提升交互感) -->
|
||||||
|
<color name="btn_gray_pressed">#757575</color>
|
||||||
|
<!-- 3. 禁用灰色(按钮不可点击态,浅灰) -->
|
||||||
|
<color name="btn_gray_disabled">#E0E0E0</color>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -1,7 +1,19 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<!-- 定义一个名为image_width的尺寸,值为200dp -->
|
|
||||||
<dimen name="log_button_height">34dp</dimen>
|
|
||||||
<!-- 定义一个名为text_size_normal的尺寸,值为16sp -->
|
|
||||||
<dimen name="log_text_size">12dp</dimen>
|
<dimen name="log_text_size">12dp</dimen>
|
||||||
|
<dimen name="log_text_padding">2dp</dimen>
|
||||||
|
|
||||||
|
<dimen name="log_button_width">65dp</dimen>
|
||||||
|
<dimen name="log_button_height">34dp</dimen>
|
||||||
|
|
||||||
|
<dimen name="log_checkbox_width">100dp</dimen>
|
||||||
|
<dimen name="log_checkbox_height">20dp</dimen>
|
||||||
|
|
||||||
|
<dimen name="log_spinner_width">60dp</dimen>
|
||||||
|
<dimen name="log_spinner_height">16dp</dimen>
|
||||||
|
<dimen name="log_spinner_item_width">@dimen/log_spinner_width</dimen>
|
||||||
|
<dimen name="log_spinner_item_height">@dimen/log_spinner_height</dimen>
|
||||||
|
<dimen name="log_spinner_text_size">@dimen/log_text_size</dimen>
|
||||||
|
<dimen name="log_spinner_text_padding">@dimen/log_text_padding</dimen>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -12,16 +12,4 @@
|
|||||||
<item name="colorTextBackgound">#FF000000</item>
|
<item name="colorTextBackgound">#FF000000</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!-- 定义 Spinner 下拉项的文字样式 -->
|
|
||||||
<style name="LogActivitySpinnerItemTextStyle" parent="@android:style/Widget.Spinner">
|
|
||||||
<item name="android:textSize">@dimen/log_text_size</item> <!-- 目标文字大小 -->
|
|
||||||
<!--<item name="android:textColor">#333333</item>--> <!-- 文字颜色 -->
|
|
||||||
<item name="android:layout_height">@dimen/log_button_height</item> <!-- 下拉项高度 -->
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<!-- 定义 Spinner 全局默认样式 -->
|
|
||||||
<style name="LogActivitySpinnerStyle" parent="@android:style/Widget.Spinner">
|
|
||||||
<item name="android:dropDownItemStyle">@style/LogActivitySpinnerItemTextStyle</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user