Android 代码改变图片颜色android:tint="@color/main_color" android:tintMode="multiply"

这篇博客介绍了如何在Android中使用`tint`属性和`tintMode`来改变图片颜色,通过不同的颜色叠加和混合模式,实现上下层图片的交互显示效果,包括交集、非交集、变暗和变亮等视觉表现。
android:tint="@color/main_color"
android:tintMode="multiply"
<!--src_in 内部填充-->
<!--src_atop 内部填充-->
<!--src_over  方形-->
<!--screen  外部填充-->
<!--add 外部填充-->
<!--multiply 正常填充-->
  1. PorterDuff.Mode.CLEAR 所绘制不会提交到画布上。
  2. PorterDuff.Mode.SRC 显示上层绘制图片
  3. PorterDuff.Mode.DST 显示下层绘制图片
  4. PorterDuff.Mode.SRC_OVER 正常绘制显示,上下层绘制叠盖。
  5. PorterDuff.Mode.DST_OVER 上下层都显示。下层居上显示。
  6. PorterDuff.Mode.SRC_IN 取两层绘制交集。显示上层。
  7. PorterDuff.Mode.DST_IN 取两层绘制交集。显示下层。
  8. PorterDuff.Mode.SRC_OUT 取上层绘制非交集部分。
  9. PorterDuff.Mode.DST_OUT 取下层绘制非交集部分。
  10. PorterDuff.Mode.SRC_ATOP 取下层非交集部分与上层交集部分
  11. PorterDuff.Mode.DST_ATOP 取上层非交集部分与下层交集部分
  12. PorterDuff.Mode.XOR 取两层绘制非交集。两层绘制非交集。
  13. PorterDuff.Mode.DARKEN 上下层都显示。变暗
  14. PorterDuff.Mode.LIGHTEN 上下层都显示。变亮
  15. PorterDuff.Mode.MULTIPLY 取两层绘制交集
  16. PorterDuff.Mode.SCREEN 上下层都显示。
<?xml version="1.0" encoding="utf-8"?> <androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/e" tools:context=".fragment.UserFragment"> <!-- 修正为正确的Fragment类名 --> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <!-- 顶部用户信息区域 --> <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/bg_welcome"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="vertical" android:padding="48dp"> <!-- 用户头像(优化尺寸适配) --> <com.google.android.material.imageview.ShapeableImageView android:id="@+id/iv_avatar" android:layout_width="80dp" android:layout_height="80dp" android:padding="2dp" android:src="@drawable/user_icon" android:scaleType="centerCrop" app:shapeAppearanceOverlay="@style/circleImageStyle" app:strokeColor="#FFFFFF" app:strokeWidth="2dp" /> <TextView android:id="@+id/tv_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="16dp" android:text="欢迎您,亲爱的花主" android:textColor="@color/white" android:textSize="18sp" android:textStyle="bold" /> </LinearLayout> </FrameLayout> <!-- 功能列表区域 --> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="16dp" android:background="@drawable/bg_border" android:orientation="vertical" android:paddingStart="16dp" android:paddingEnd="16dp"> <!-- 我的订单 --> <LinearLayout android:id="@+id/myrecord" android:layout_width="match_parent" android:layout_height="48dp" android:gravity="center_vertical" android:orientation="horizontal" android:clickable="true" android:focusable="true" android:background="?attr/selectableItemBackground"> <!-- 添加点击反馈 --> <ImageView android:layout_width="24dp" android:layout_height="24dp" android:layout_marginEnd="8dp" android:src="@drawable/ic_order" android:scaleType="centerInside" app:tint="@color/text_hint" /> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="我的订单" android:textColor="@color/text_hint" android:textSize="14sp" android:textStyle="bold" /> <ImageView android:layout_width="16dp" android:layout_height="16dp" android:src="@drawable/arrow_right" android:scaleType="centerInside" /> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="1dp" android:background="@color/divider" /> <!-- 移除冗余分割线(原代码中有重复分割线) --> <!-- 个人信息 --> <LinearLayout android:id="@+id/ll_info" android:layout_width="match_parent" android:layout_height="48dp" android:gravity="center_vertical" android:orientation="horizontal" android:clickable="true" android:focusable="true" android:background="?attr/selectableItemBackground"> <ImageView android:layout_width="24dp" android:layout_height="24dp" android:layout_marginEnd="8dp" android:src="@drawable/user_icon" android:scaleType="centerInside" app:tint="@color/text_hint" /> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="个人信息" android:textColor="@color/text_hint" android:textSize="14sp" android:textStyle="bold" /> <ImageView android:layout_width="16dp" android:layout_height="16dp" android:src="@drawable/arrow_right" android:scaleType="centerInside" /> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="1dp" android:background="@color/divider" /> <!-- 联系客服 --> <LinearLayout android:id="@+id/ll_contact" android:layout_width="match_parent" android:layout_height="48dp" android:gravity="center_vertical" android:orientation="horizontal" android:clickable="true" android:focusable="true" android:background="?attr/selectableItemBackground"> <ImageView android:layout_width="24dp" android:layout_height="24dp" android:layout_marginEnd="8dp" android:src="@drawable/ic_contact" android:scaleType="centerInside" app:tint="@color/text_hint" /> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="联系客服" android:textColor="@color/text_hint" android:textSize="14sp" android:textStyle="bold" /> <ImageView android:layout_width="16dp" android:layout_height="16dp" android:src="@drawable/arrow_right" android:scaleType="centerInside" /> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="1dp" android:background="@color/divider" /> <!-- 关于商店 --> <LinearLayout android:id="@+id/ll_about" android:layout_width="match_parent" android:layout_height="48dp" android:gravity="center_vertical" android:orientation="horizontal" android:clickable="true" android:focusable="true" android:background="?attr/selectableItemBackground"> <ImageView android:layout_width="24dp" android:layout_height="24dp" android:layout_marginEnd="8dp" android:src="@drawable/ic_about" android:scaleType="centerInside" app:tint="@color/text_hint" /> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="关于商店" android:textColor="@color/text_hint" android:textSize="14sp" android:textStyle="bold" /> <ImageView android:layout_width="16dp" android:layout_height="16dp" android:src="@drawable/arrow_right" android:scaleType="centerInside" /> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="1dp" android:background="@color/divider" /> <!-- 退出登录 --> <LinearLayout android:id="@+id/ll_logout" android:layout_width="match_parent" android:layout_height="48dp" android:gravity="center_vertical" android:orientation="horizontal" android:clickable="true" android:focusable="true" android:background="?attr/selectableItemBackground"> <ImageView android:layout_width="24dp" android:layout_height="24dp" android:layout_marginEnd="8dp" android:src="@drawable/ic_logout" android:scaleType="centerInside" app:tint="@color/text_hint" /> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="退出登录" android:textColor="@color/text_hint" android:textSize="14sp" android:textStyle="bold" /> <ImageView android:layout_width="16dp" android:layout_height="16dp" android:src="@drawable/arrow_right" android:scaleType="centerInside" /> </LinearLayout> </LinearLayout> </LinearLayout> </androidx.core.widget.NestedScrollView>这是我fragment_me.xml里的代码,根据你的提示,把它补充完整,我需要完整的代码
最新发布
10-30
<?xml version="1.0" encoding="utf-8"?> <androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/e" tools:context=".fragment.UserFragment"> <!-- 修正为正确的Fragment类名 --> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <!-- 顶部用户信息区域 --> <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/bg_welcome"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="vertical" android:padding="48dp"> <!-- 用户头像(优化尺寸适配) --> <com.google.android.material.imageview.ShapeableImageView android:id="@+id/iv_avatar" android:layout_width="80dp" android:layout_height="80dp" android:padding="2dp" android:src="@drawable/user_icon" android:scaleType="centerCrop" app:shapeAppearanceOverlay="@style/circleImageStyle" app:strokeColor="#FFFFFF" app:strokeWidth="2dp" /> <TextView android:id="@+id/tv_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="16dp" android:text="欢迎您,亲爱的花主" android:textColor="@color/white" android:textSize="18sp" android:textStyle="bold" /> </LinearLayout> </FrameLayout> <!-- 功能列表区域 --> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="16dp" android:background="@drawable/bg_border" android:orientation="vertical" android:paddingStart="16dp" android:paddingEnd="16dp"> <!-- 我的订单 --> <LinearLayout android:id="@+id/myrecord" android:layout_width="match_parent" android:layout_height="48dp" android:gravity="center_vertical" android:orientation="horizontal" android:clickable="true" android:focusable="true" android:background="?attr/selectableItemBackground"> <!-- 添加点击反馈 --> <ImageView android:layout_width="24dp" android:layout_height="24dp" android:layout_marginEnd="8dp" android:src="@drawable/ic_order" android:scaleType="centerInside" app:tint="@color/text_hint" /> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="我的订单" android:textColor="@color/text_hint" android:textSize="14sp" android:textStyle="bold" /> <ImageView android:layout_width="16dp" android:layout_height="16dp" android:src="@drawable/arrow_right" android:scaleType="centerInside" /> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="1dp" android:background="@color/divider" /> <!-- 移除冗余分割线(原代码中有重复分割线) --> <!-- 个人信息 --> <LinearLayout android:id="@+id/ll_info" android:layout_width="match_parent" android:layout_height="48dp" android:gravity="center_vertical" android:orientation="horizontal" android:clickable="true" android:focusable="true" android:background="?attr/selectableItemBackground"> <ImageView android:layout_width="24dp" android:layout_height="24dp" android:layout_marginEnd="8dp" android:src="@drawable/user_icon" android:scaleType="centerInside" app:tint="@color/text_hint" /> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="个人信息" android:textColor="@color/text_hint" android:textSize="14sp" android:textStyle="bold" /> <ImageView android:layout_width="16dp" android:layout_height="16dp" android:src="@drawable/arrow_right" android:scaleType="centerInside" /> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="1dp" android:background="@color/divider" /> <!-- 联系客服 --> <LinearLayout android:id="@+id/ll_contact" android:layout_width="match_parent" android:layout_height="48dp" android:gravity="center_vertical" android:orientation="horizontal" android:clickable="true" android:focusable="true" android:background="?attr/selectableItemBackground"> <ImageView android:layout_width="24dp" android:layout_height="24dp" android:layout_marginEnd="8dp" android:src="@drawable/ic_contact" android:scaleType="centerInside" app:tint="@color/text_hint" /> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="联系客服" android:textColor="@color/text_hint" android:textSize="14sp" android:textStyle="bold" /> <ImageView android:layout_width="16dp" android:layout_height="16dp" android:src="@drawable/arrow_right" android:scaleType="centerInside" /> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="1dp" android:background="@color/divider" /> <!-- 关于商店 --> <LinearLayout android:id="@+id/ll_about" android:layout_width="match_parent" android:layout_height="48dp" android:gravity="center_vertical" android:orientation="horizontal" android:clickable="true" android:focusable="true" android:background="?attr/selectableItemBackground"> <ImageView android:layout_width="24dp" android:layout_height="24dp" android:layout_marginEnd="8dp" android:src="@drawable/ic_about" android:scaleType="centerInside" app:tint="@color/text_hint" /> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="关于商店" android:textColor="@color/text_hint" android:textSize="14sp" android:textStyle="bold" /> <ImageView android:layout_width="16dp" android:layout_height="16dp" android:src="@drawable/arrow_right" android:scaleType="centerInside" /> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="1dp" android:background="@color/divider" /> <!-- 退出登录 --> <LinearLayout android:id="@+id/ll_logout" android:layout_width="match_parent" android:layout_height="48dp" android:gravity="center_vertical" android:orientation="horizontal" android:clickable="true" android:focusable="true" android:background="?attr/selectableItemBackground"> <ImageView android:layout_width="24dp" android:layout_height="24dp" android:layout_marginEnd="8dp" android:src="@drawable/ic_logout" android:scaleType="centerInside" app:tint="@color/text_hint" /> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="退出登录" android:textColor="@color/text_hint" android:textSize="14sp" android:textStyle="bold" /> <ImageView android:layout_width="16dp" android:layout_height="16dp" android:src="@drawable/arrow_right" android:scaleType="centerInside" /> </LinearLayout> </LinearLayout> </LinearLayout> </androidx.core.widget.NestedScrollView>我的该xml名为fragment__me,而不是activity_main.xml,这是我fragment__me里的代码,请根据你的提示,帮我修改里面的代码
10-30
要求参考已有的activity_add_task.xml内容如下,并给出完整的activity_edit_task.xml:<?xml version="1.0" encoding="utf-8"?> <androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/light_background" android:fillViewport="true"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="16dp"> <!-- 标题栏 --> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:paddingBottom="16dp" android:text="创建新任务" android:textColor="@color/primary_dark" android:textSize="24sp" android:textStyle="bold" /> <!-- 必填项卡片 --> <com.google.android.material.card.MaterialCardView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="16dp" app:cardCornerRadius="12dp" app:cardElevation="4dp" app:strokeColor="@color/primary_light" app:strokeWidth="1dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="16dp"> <!-- 卡片标题 --> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:drawableStart="@drawable/ic_info_outline" android:drawablePadding="8dp" android:gravity="center_vertical" android:paddingBottom="12dp" android:text="必填信息" android:textColor="@color/primary_dark" android:textSize="18sp" android:textStyle="bold" /> <!-- 任务标题 --> <com.google.android.material.textfield.TextInputLayout style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="16dp" android:hint="任务标题 *" app:boxStrokeColor="@color/primary" app:errorEnabled="true"> <com.google.android.material.textfield.TextInputEditText android:id="@+id/taskTitleEditText" style="@style/CustomTextInputEditText" android:layout_width="match_parent" android:layout_height="wrap_content" /> </com.google.android.material.textfield.TextInputLayout> <!-- 分类选择 --> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:text="分类 *" android:textColor="@color/primary_dark" android:textSize="14sp" android:textStyle="bold" /> <!-- 分类按钮组 - 紧凑布局 --> <com.google.android.material.button.MaterialButtonToggleGroup android:id="@+id/categoryToggleGroup" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="16dp" app:selectionRequired="true" app:singleSelection="true"> </com.google.android.material.button.MaterialButtonToggleGroup> <!-- 重要性行 --> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:text="重要性 *" android:textColor="@color/primary_dark" android:textSize="14sp" android:textStyle="bold" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="16dp" android:gravity="center_vertical" android:orientation="horizontal" android:paddingVertical="10dp"> <RatingBar android:id="@+id/importanceRatingBar" style="@style/Widget.AppCompat.RatingBar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:isIndicator="false" android:numStars="5" android:progressBackgroundTint="@color/light_gray" android:progressTint="@color/primary" android:rating="3" android:stepSize="1" android:theme="@style/RatingBarStyle" /> <TextView android:id="@+id/ratingText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="16dp" android:text="中等" android:textColor="@color/primary_dark" android:textSize="16sp" /> </LinearLayout> <!-- 期待完成时长 - 标签和设置在同一行 --> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:gravity="center_vertical" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="8dp" android:text="期待完成时长 *" android:textColor="@color/primary_dark" android:textSize="14sp" android:textStyle="bold" /> <TextView android:id="@+id/durationDisplay" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="0 分钟" android:textColor="@color/red" android:textSize="14sp" /> </LinearLayout> <!-- 时间增加按钮行 - 完全按照原界面设计 --> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="4dp" android:orientation="horizontal"> <TextView android:id="@+id/add60TextView" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="?selectableItemBackground" android:clickable="true" android:focusable="true" android:gravity="center" android:padding="8dp" android:text="+60" android:textColor="@color/primary_dark" android:textSize="14sp" /> <TextView android:id="@+id/add30TextView" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="?selectableItemBackground" android:clickable="true" android:focusable="true" android:gravity="center" android:padding="8dp" android:text="+30" android:textColor="@color/primary_dark" android:textSize="14sp" /> <TextView android:id="@+id/add15TextView" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="?selectableItemBackground" android:clickable="true" android:focusable="true" android:gravity="center" android:padding="8dp" android:text="+15" android:textColor="@color/primary_dark" android:textSize="14sp" /> <TextView android:id="@+id/add10TextView" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="?selectableItemBackground" android:clickable="true" android:focusable="true" android:gravity="center" android:padding="8dp" android:text="+10" android:textColor="@color/primary_dark" android:textSize="14sp" /> <TextView android:id="@+id/add5TextView" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="?selectableItemBackground" android:clickable="true" android:focusable="true" android:gravity="center" android:padding="8dp" android:text="+5" android:textColor="@color/primary_dark" android:textSize="14sp" /> <TextView android:id="@+id/add1TextView" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="?selectableItemBackground" android:clickable="true" android:focusable="true" android:gravity="center" android:padding="8dp" android:text="+1" android:textColor="@color/primary_dark" android:textSize="14sp" /> </LinearLayout> <!-- 时间减少按钮行 - 完全按照原界面设计 --> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:id="@+id/reduce60TextView" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="?selectableItemBackground" android:clickable="true" android:focusable="true" android:gravity="center" android:padding="8dp" android:text="-60" android:textColor="@color/primary_dark" android:textSize="14sp" /> <TextView android:id="@+id/reduce30TextView" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="?selectableItemBackground" android:clickable="true" android:focusable="true" android:gravity="center" android:padding="8dp" android:text="-30" android:textColor="@color/primary_dark" android:textSize="14sp" /> <TextView android:id="@+id/reduce15TextView" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="?selectableItemBackground" android:clickable="true" android:focusable="true" android:gravity="center" android:padding="8dp" android:text="-15" android:textColor="@color/primary_dark" android:textSize="14sp" /> <TextView android:id="@+id/reduce10TextView" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="?selectableItemBackground" android:clickable="true" android:focusable="true" android:gravity="center" android:padding="8dp" android:text="-10" android:textColor="@color/primary_dark" android:textSize="14sp" /> <TextView android:id="@+id/reduce5TextView" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="?selectableItemBackground" android:clickable="true" android:focusable="true" android:gravity="center" android:padding="8dp" android:text="-5" android:textColor="@color/primary_dark" android:textSize="14sp" /> <TextView android:id="@+id/reduce1TextView" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="?selectableItemBackground" android:clickable="true" android:focusable="true" android:gravity="center" android:padding="8dp" android:text="-1" android:textColor="@color/primary_dark" android:textSize="14sp" /> </LinearLayout> </LinearLayout> </com.google.android.material.card.MaterialCardView> <!-- 子任务卡片 - 新增独立卡片 --> <com.google.android.material.card.MaterialCardView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="16dp" app:cardCornerRadius="12dp" app:cardElevation="4dp" app:strokeColor="@color/primary_light" app:strokeWidth="1dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="16dp"> <!-- 子任务标题 --> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:drawableStart="@drawable/ic_subtask" android:drawablePadding="8dp" android:gravity="center_vertical" android:paddingBottom="12dp" android:text="子任务" android:textColor="@color/primary_dark" android:textSize="18sp" android:textStyle="bold" /> <!-- 添加子任务按钮 --> <com.google.android.material.button.MaterialButton android:id="@+id/addSubtaskButton" style="@style/Widget.MaterialComponents.Button.OutlinedButton" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:drawableStart="@drawable/ic_add_24dp" android:drawableTint="@color/primary" android:text="添加子任务" android:textColor="@color/primary" app:iconGravity="textStart" /> <!-- 子任务列表 --> <LinearLayout android:id="@+id/subtasksContainer" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:paddingTop="2dp"> <!-- 空状态提示 --> <TextView android:id="@+id/emptySubtasksText" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:padding="24dp" android:text="暂无子任务,点击上方按钮添加" android:textColor="#888" /> </LinearLayout> </LinearLayout> </com.google.android.material.card.MaterialCardView> <!-- 可选项折叠面板 --> <com.google.android.material.card.MaterialCardView android:id="@+id/expandableCard" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="16dp" app:cardCornerRadius="12dp" app:cardElevation="2dp"> <!-- 折叠面板标题 --> <LinearLayout android:id="@+id/expandableHeader" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/selectableItemBackground" android:minHeight="56dp" android:orientation="horizontal" android:padding="16dp"> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:drawableStart="@drawable/ic_baseline_tune_24" android:drawablePadding="8dp" android:gravity="center_vertical" android:text="更多选项" android:textColor="@color/primary" android:textSize="16sp" android:textStyle="bold" /> <ImageView android:id="@+id/expandIcon" android:layout_width="24dp" android:layout_height="24dp" android:layout_gravity="center" android:src="@drawable/ic_baseline_expand_more_24" app:tint="@color/primary" /> </LinearLayout> <!-- 可选项内容(默认折叠) --> <LinearLayout android:id="@+id/expandableContent" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="40dp" android:orientation="vertical" android:padding="16dp" android:visibility="gone"> <!-- 任务执行日期 - 移动到更多选项中 --> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:text="任务执行日期" android:textColor="@color/primary_dark" android:textSize="14sp" android:textStyle="bold" /> <!-- 日期选项组 - 减少间距确保文本完整显示 --> <com.google.android.material.button.MaterialButtonToggleGroup android:id="@+id/dateToggleGroup" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="16dp" app:selectionRequired="true" app:singleSelection="true"> <com.google.android.material.button.MaterialButton android:id="@+id/btnToday" style="@style/CompactButton" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginEnd="2dp" android:layout_weight="1" android:text="今天" app:backgroundTint="@color/button_background_selector" /> <com.google.android.material.button.MaterialButton android:id="@+id/btnTomorrow" style="@style/CompactButton" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginEnd="2dp" android:layout_weight="1" android:text="明天" app:backgroundTint="@color/button_background_selector" /> <com.google.android.material.button.MaterialButton android:id="@+id/btnSelectDate" style="@style/CompactButton" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginEnd="2dp" android:layout_weight="1" android:text="选择日期" app:backgroundTint="@color/button_background_selector" /> <!-- 确保"没有日期"完全显示 --> <com.google.android.material.button.MaterialButton android:id="@+id/btnNoDate" style="@style/CompactButton" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1.2" android:text="没有日期" app:backgroundTint="@color/button_background_selector" /> </com.google.android.material.button.MaterialButtonToggleGroup> <!-- 父级目标 --> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:text="父级目标" android:textColor="@color/primary_dark" android:textSize="14sp" android:textStyle="bold" /> <com.google.android.material.textfield.TextInputLayout style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="16dp" android:hint="选择父级目标" app:boxStrokeColor="@color/primary_light" app:hintTextColor="@color/gray_500" app:startIconTint="@color/primary"> <com.google.android.material.textfield.MaterialAutoCompleteTextView android:id="@+id/parentTargetAutoComplete" android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="none" android:padding="3dp" android:paddingLeft="8dp" /> </com.google.android.material.textfield.TextInputLayout> <!-- 重复选项 --> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:text="重复选项" android:textColor="@color/primary_dark" android:textSize="14sp" android:textStyle="bold" /> <!-- 重复选项组 - 增加"每年"选项并调整间距 --> <com.google.android.material.button.MaterialButtonToggleGroup android:id="@+id/repeatToggleGroup" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="16dp" app:selectionRequired="true" app:singleSelection="true"> <com.google.android.material.button.MaterialButton android:id="@+id/btnNoRepeat" style="@style/CompactButton" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginEnd="2dp" android:layout_weight="1" android:text="不重复" app:backgroundTint="@color/button_background_selector" /> <com.google.android.material.button.MaterialButton android:id="@+id/btnDaily" style="@style/CompactButton" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginEnd="2dp" android:layout_weight="1" android:text="每日" app:backgroundTint="@color/button_background_selector" /> <com.google.android.material.button.MaterialButton android:id="@+id/btnWeekly" style="@style/CompactButton" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginEnd="2dp" android:layout_weight="1" android:text="每周" app:backgroundTint="@color/button_background_selector" /> <com.google.android.material.button.MaterialButton android:id="@+id/btnMonthly" style="@style/CompactButton" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginEnd="2dp" android:layout_weight="1" android:text="每月" app:backgroundTint="@color/button_background_selector" /> <!-- 新增每年选项 --> <com.google.android.material.button.MaterialButton android:id="@+id/btnYearly" style="@style/CompactButton" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="每年" app:backgroundTint="@color/button_background_selector" /> </com.google.android.material.button.MaterialButtonToggleGroup> <!-- 任务描述 --> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:text="任务描述" android:textColor="@color/primary_dark" android:textSize="14sp" android:textStyle="bold" /> <com.google.android.material.textfield.TextInputLayout style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="16dp" android:hint="详细描述任务内容..." app:boxStrokeColor="@color/primary_light" app:startIconDrawable="@drawable/ic_baseline_description_24" app:startIconTint="@color/primary"> <com.google.android.material.textfield.TextInputEditText android:id="@+id/taskDescriptionEditText" style="@style/CustomTextInputEditText" android:layout_width="match_parent" android:layout_height="120dp" android:gravity="top" android:inputType="textMultiLine" /> </com.google.android.material.textfield.TextInputLayout> <!-- 提醒设置 --> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:text="提醒设置" android:textColor="@color/primary_dark" android:textSize="14sp" android:textStyle="bold" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="16dp" android:orientation="vertical"> <androidx.appcompat.widget.SwitchCompat android:id="@+id/reminderSwitch" android:layout_width="match_parent" android:layout_height="wrap_content" android:checked="false" android:text="启用提醒" android:textColor="@color/gray_500" /> <LinearLayout android:id="@+id/reminderOptionsLayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="8dp" android:orientation="horizontal" android:visibility="gone"> <com.google.android.material.textfield.TextInputLayout style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginEnd="8dp" android:layout_weight="1" android:hint="提前时间" app:boxStrokeColor="@color/primary_light"> <com.google.android.material.textfield.TextInputEditText android:id="@+id/reminderTimeEditText" android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="number" /> </com.google.android.material.textfield.TextInputLayout> <Spinner android:id="@+id/reminderUnitSpinner" style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" /> </LinearLayout> </LinearLayout> <!-- 任务状态 --> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:text="任务状态" android:textColor="@color/primary_dark" android:textSize="14sp" android:textStyle="bold" /> <com.google.android.material.button.MaterialButtonToggleGroup android:id="@+id/statusToggleGroup" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="16dp" app:selectionRequired="true" app:singleSelection="true"> <com.google.android.material.button.MaterialButton android:id="@+id/btnNotStarted" style="@style/CompactButton" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="未开始" app:backgroundTint="@color/button_background_selector" /> <com.google.android.material.button.MaterialButton android:id="@+id/btnInProgress" style="@style/CompactButton" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="进行中" app:backgroundTint="@color/button_background_selector" /> </com.google.android.material.button.MaterialButtonToggleGroup> <!-- 进度设置 --> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:text="进度 (%)" android:textColor="@color/primary_dark" android:textSize="14sp" android:textStyle="bold" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="16dp" android:gravity="center_vertical" android:orientation="horizontal"> <SeekBar android:id="@+id/progressSeekBar" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:max="100" android:progress="0" /> <TextView android:id="@+id/progressText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="16dp" android:text="0%" android:textColor="@color/primary_dark" android:textSize="16sp" /> </LinearLayout> <!-- 创建时机选择 --> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:text="创建时机" android:textColor="@color/primary_dark" android:textSize="14sp" android:textStyle="bold" /> <com.google.android.material.textfield.TextInputLayout style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="16dp" app:boxStrokeColor="@color/primary" app:startIconDrawable="@drawable/ic_baseline_access_time_24" app:startIconTint="@color/primary"> <com.google.android.material.textfield.MaterialAutoCompleteTextView android:id="@+id/creationTimingSpinner" android:layout_width="match_parent" android:layout_height="wrap_content" android:focusable="false" android:hint="选择创建时机" android:inputType="none" /> </com.google.android.material.textfield.TextInputLayout> </LinearLayout> </com.google.android.material.card.MaterialCardView> <!-- 操作按钮 --> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:orientation="horizontal" android:paddingTop="8dp"> <com.google.android.material.button.MaterialButton android:id="@+id/cancelButton" style="@style/CompactButton" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginEnd="8dp" android:layout_weight="1" android:text="取消" android:textColor="@color/primary_dark" app:backgroundTint="@color/light_gray" /> <com.google.android.material.button.MaterialButton android:id="@+id/createButton" style="@style/Widget.MaterialComponents.Button" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="8dp" android:layout_weight="1" android:text="创建任务" android:textColor="@color/white" app:backgroundTint="@color/primary" /> </LinearLayout> </LinearLayout> </androidx.core.widget.NestedScrollView>
07-05
<?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white" tools:context=".editpreset.EditPresetFragment"> <ImageView android:id="@+id/imageView3" android:layout_width="24dp" android:layout_height="24dp" android:layout_marginStart="16dp" android:scaleType="centerInside" android:src="@drawable/close" app:layout_constraintBottom_toBottomOf="@+id/edit_auto_white" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="@+id/edit_auto_white" /> <TextView android:id="@+id/edit_auto_white" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="16dp" android:text="Edit Auto White" android:textSize="20dp" app:layout_constraintStart_toEndOf="@+id/imageView3" app:layout_constraintTop_toTopOf="parent"> </TextView> <ImageView android:layout_width="24dp" android:layout_height="24dp" android:layout_marginEnd="16dp" android:scaleType="centerInside" android:src="@drawable/ok" app:layout_constraintBottom_toBottomOf="@+id/edit_auto_white" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="@+id/edit_auto_white" app:layout_constraintVertical_bias="1.0" /> <!-- res/layout/fragment_tab_selector.xml --> <androidx.cardview.widget.CardView android:id="@+id/cardView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="16dp" app:cardCornerRadius="50dp" app:cardElevation="4dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/edit_auto_white"> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="5dp" android:layout_marginEnd="5dp"> <com.google.android.material.button.MaterialButton android:id="@+id/buttonA" android:layout_width="130dp" android:layout_height="48dp" android:checkable="true" android:checked="true" android:text="White Light" android:textColor="@android:color/black" android:textSize="14dp" app:backgroundTint="@android:color/white" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:rippleColor="@android:color/transparent" /> <com.google.android.material.button.MaterialButton android:id="@+id/buttonB" android:layout_width="130dp" android:layout_height="48dp" android:checkable="true" android:checked="true" android:text="Color Light" android:textColor="@android:color/black" android:textSize="14dp" app:backgroundTint="@android:color/white" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/buttonA" app:layout_constraintTop_toTopOf="parent" app:rippleColor="@android:color/transparent" /> </androidx.constraintlayout.widget.ConstraintLayout> <!-- <com.google.android.material.button.MaterialButtonToggleGroup--> <!-- android:id="@+id/optionGroup"--> <!-- android:layout_width="wrap_content"--> <!-- android:layout_height="wrap_content"--> <!-- android:orientation="horizontal"--> <!-- app:selectionRequired="true">--> <!-- <com.google.android.material.button.MaterialButton--> <!-- android:id="@+id/buttonA"--> <!-- android:layout_width="96dp"--> <!-- android:layout_height="48dp"--> <!-- android:checkable="true"--> <!-- android:checked="true"--> <!-- android:text="White Light"--> <!-- android:textSize="14dp"--> <!-- android:textColor="@android:color/black"--> <!-- app:backgroundTint="@android:color/white"--> <!-- app:rippleColor="@android:color/transparent" />--> <!-- <com.google.android.material.button.MaterialButton--> <!-- android:id="@+id/buttonB"--> <!-- android:layout_width="120dp"--> <!-- android:layout_height="48dp"--> <!-- android:checkable="true"--> <!-- android:text="Color Light"--> <!-- android:textColor="@android:color/black"--> <!-- app:backgroundTint="@android:color/white"--> <!-- app:rippleColor="@android:color/transparent" />--> <!-- </com.google.android.material.button.MaterialButtonToggleGroup>--> </androidx.cardview.widget.CardView> <TextView android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="28dp" android:text="Color Temperature" android:textColor="@color/text_gray" android:textSize="14dp" app:layout_constraintStart_toStartOf="@+id/imageView3" app:layout_constraintTop_toBottomOf="@id/cardView" /> <TextView android:id="@+id/textView4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="44dp" android:text="Warm" android:textColor="@color/text_gray" android:textSize="14dp" app:layout_constraintStart_toStartOf="@+id/textView3" app:layout_constraintTop_toBottomOf="@+id/textView3" /> <TextView android:id="@+id/textView5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="52dp" android:text="Recommend" android:textColor="@color/text_gray" android:textSize="14dp" app:layout_constraintStart_toStartOf="@+id/textView3" app:layout_constraintTop_toBottomOf="@+id/textView4" /> <TextView android:id="@+id/textView6" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="52dp" android:text="White" android:textColor="@color/text_gray" android:textSize="14dp" app:layout_constraintStart_toStartOf="@+id/textView3" app:layout_constraintTop_toBottomOf="@+id/textView5" /> <TextView android:id="@+id/textView7" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="52dp" android:text="Daylight" android:textColor="@color/text_gray" android:textSize="14dp" app:layout_constraintStart_toStartOf="@+id/textView3" app:layout_constraintTop_toBottomOf="@+id/textView6" /> <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="44dp" android:text="Cool" android:textColor="@color/text_gray" android:textSize="14dp" app:layout_constraintStart_toStartOf="@+id/textView3" app:layout_constraintTop_toBottomOf="@+id/textView7" /> <androidx.constraintlayout.widget.Guideline android:id="@+id/guideline" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" app:layout_constraintGuide_end="20.8dp"> </androidx.constraintlayout.widget.Guideline> <View android:id="@+id/view3" android:layout_width="0dp" android:layout_height="2dp" android:layout_marginStart="15.2dp" android:background="@drawable/link" android:layerType="software" app:layout_constraintBottom_toBottomOf="@+id/textView4" app:layout_constraintEnd_toStartOf="@+id/guideline" app:layout_constraintStart_toEndOf="@+id/textView4" app:layout_constraintTop_toTopOf="@+id/textView4" /> <View android:id="@+id/view6" android:layout_width="0dp" android:layout_height="2dp" android:layout_marginStart="15.2dp" android:background="@drawable/link" android:layerType="software" app:layout_constraintBottom_toBottomOf="@+id/textView5" app:layout_constraintEnd_toStartOf="@+id/guideline" app:layout_constraintStart_toEndOf="@+id/textView5" app:layout_constraintTop_toTopOf="@+id/textView5" /> <View android:id="@+id/view4" android:layout_width="0dp" android:layout_height="2dp" android:layout_marginStart="15.2dp" android:background="@drawable/link" android:layerType="software" app:layout_constraintBottom_toBottomOf="@+id/textView6" app:layout_constraintEnd_toEndOf="@+id/view3" app:layout_constraintStart_toEndOf="@+id/textView6" app:layout_constraintTop_toTopOf="@+id/textView6" /> <View android:id="@+id/view5" android:layout_width="0dp" android:layout_height="2dp" android:layout_marginStart="15.2dp" android:background="@drawable/link" android:layerType="software" app:layout_constraintBottom_toBottomOf="@+id/textView7" app:layout_constraintEnd_toEndOf="@+id/view3" app:layout_constraintStart_toEndOf="@+id/textView7" app:layout_constraintTop_toTopOf="@+id/textView7" /> <View android:id="@+id/view7" android:layout_width="0dp" android:layout_height="2dp" android:layout_marginStart="15.2dp" android:background="@drawable/link" android:layerType="software" app:layout_constraintBottom_toBottomOf="@+id/textView2" app:layout_constraintEnd_toEndOf="@+id/view3" app:layout_constraintStart_toEndOf="@+id/textView2" app:layout_constraintTop_toTopOf="@+id/textView2" /> <View android:id="@+id/view8" android:layout_width="match_parent" android:layout_height="8dp" android:layout_marginTop="20dp" android:background="@color/background_gray" app:layout_constraintTop_toBottomOf="@+id/textView2" /> <TextView android:id="@+id/textView8" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="16dp" android:text="Light" android:textColor="@color/text_gray" android:textSize="16dp" android:textStyle="bold" app:layout_constraintStart_toStartOf="@+id/textView2" app:layout_constraintTop_toBottomOf="@+id/view8" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="16dp" android:text="0%" android:textColor="@color/text_gray" android:textSize="16dp" android:textStyle="bold" app:layout_constraintEnd_toStartOf="@+id/guideline" app:layout_constraintTop_toBottomOf="@+id/view8" /> <SeekBar android:id="@+id/seekBar" android:layout_width="292dp" android:layout_height="wrap_content" android:layout_marginTop="22dp" android:progressTint="#FFCB00" android:thumb="@drawable/lightset" android:thumbOffset="16dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/textView8" /> <View android:layout_width="match_parent" android:layout_height="58dp" app:layout_constraintTop_toBottomOf="@+id/seekBar" /> <!-- <ImageView--> <!-- android:layout_width="60dp"--> <!-- android:layout_height="238dp"--> <!-- android:scaleType="centerInside"--> <!-- android:src="@drawable/color_temperature"--> <!-- app:layout_constraintBottom_toBottomOf="@+id/textView6"--> <!-- app:layout_constraintEnd_toEndOf="parent"--> <!-- app:layout_constraintStart_toStartOf="parent"--> <!-- app:layout_constraintTop_toTopOf="@+id/textView6" />--> <!-- 原始背景图 --> <ImageView android:id="@+id/color_temperature" android:layout_width="60dp" android:layout_height="238dp" android:scaleType="centerInside" android:src="@drawable/color_temperature" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <!-- 自定义叠加 View --> <com.example.bulbpage.whiteedit.ColorTemperatureOverlayView android:id="@+id/overlayView" android:layout_width="60dp" android:layout_height="238dp" app:layout_constraintBottom_toBottomOf="@+id/color_temperature" app:layout_constraintEnd_toEndOf="@+id/color_temperature" app:layout_constraintStart_toStartOf="@+id/color_temperature" app:layout_constraintTop_toTopOf="@+id/color_temperature" /> <!-- 显示色温值 --> <TextView android:id="@+id/temperatureTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="5000K" android:textSize="14dp" app:layout_constraintBottom_toBottomOf="@+id/textView3" app:layout_constraintEnd_toStartOf="@+id/guideline" app:layout_constraintTop_toTopOf="@+id/textView3" /> </androidx.constraintlayout.widget.ConstraintLayout>给我修改后的完整代码
08-26
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值