android 设置各种颜色 android:background="@color/white"

本文档详细列举了各种颜色的XML定义及其对应的十六进制颜色代码。这些颜色包括从基本的白色到复杂的紫罗兰色等,适用于UI设计和前端开发中颜色配置的需求。

[create file color.xml at res/values/]


<?xml version="1.0" encoding="utf-8"?>


<resources>


<color name="white">#FFFFFF</color><!--白色 -->


<color name="ivory">#FFFFF0</color><!--象牙色 -->


<color name="lightyellow">#FFFFE0</color><!--亮黄色 -->


<color name="yellow">#FFFF00</color><!--黄色 -->


<color name="snow">#FFFAFA</color><!--雪白色 -->


<color name="floralwhite">#FFFAF0</color><!--花白色 -->


<color name="lemonchiffon">#FFFACD</color><!--柠檬绸色 -->


<color name="cornsilk">#FFF8DC</color><!--米绸色 -->


<color name="seashell">#FFF5EE</color><!--海贝色 -->


<color name="lavenderblush">#FFF0F5</color><!--淡紫红 -->


<color name="papayawhip">#FFEFD5</color><!--番木色 -->


<color name="blanchedalmond">#FFEBCD</color><!--白杏色 -->


<color name="mistyrose">#FFE4E1</color><!--浅玫瑰色 -->


<color name="bisque">#FFE4C4</color><!--桔黄色 -->


<color name="moccasin">#FFE4B5</color><!--鹿皮色 -->


<color name="navajowhite">#FFDEAD</color><!--纳瓦白 -->


<color name="peachpuff">#FFDAB9</color><!--桃色 -->


<color name="gold">#FFD700</color><!--金色 -->


<color name="pink">#FFC0CB</color><!--粉红色 -->


<color name="lightpink">#FFB6C1</color><!--亮粉红色 -->


<color name="orange">#FFA500</color><!--橙色 -->


<color name="lightsalmon">#FFA07A</color><!--亮肉色 -->


<color name="darkorange">#FF8C00</color><!--暗桔黄色 -->


<color name="coral">#FF7F50</color><!--珊瑚色 -->


<color name="hotpink">#FF69B4</color><!--热粉红色 -->


<color name="tomato">#FF6347</color><!--西红柿色 -->


<color name="orangered">#FF4500</color><!--红橙色 -->


<color name="deeppink">#FF1493</color><!--深粉红色 -->


<color name="fuchsia">#FF00FF</color><!--紫红色 -->


<color name="magenta">#FF00FF</color><!--红紫色 -->


<color name="red">#FF0000</color><!--红色 -->


<color name="oldlace">#FDF5E6</color><!--老花色 -->


<color name="lightgoldenrodyellow">#FAFAD2</color><!--亮金黄色 -->


<color name="linen">#FAF0E6</color><!--亚麻色 -->


<color name="antiquewhite">#FAEBD7</color><!--古董白 -->


<color name="salmon">#FA8072</color><!--鲜肉色 -->


<color name="ghostwhite">#F8F8FF</color><!--幽灵白 -->


<color name="mintcream">#F5FFFA</color><!--薄荷色 -->


<color name="whitesmoke">#F5F5F5</color><!--烟白色 -->


<color name="beige">#F5F5DC</color><!--米色 -->


<color name="wheat">#F5DEB3</color><!--浅黄色 -->


<color name="sandybrown">#F4A460</color><!--沙褐色 -->


<color name="azure">#F0FFFF</color><!--天蓝色 -->


<color name="honeydew">#F0FFF0</color><!--蜜色 -->


<color name="aliceblue">#F0F8FF</color><!--艾利斯兰 -->


<color name="khaki">#F0E68C</color><!--黄褐色 -->


<color name="lightcoral">#F08080</color><!--亮珊瑚色 -->


<color name="palegoldenrod">#EEE8AA</color><!--苍麒麟色 -->


<color name="violet">#EE82EE</color><!--紫罗兰色 -->


<color name="darksalmon">#E9967A</color><!--暗肉色 -->


<color name="lavender">#E6E6FA</color><!--淡紫色 -->


<color name="lightcyan">#E0FFFF</color><!--亮青色 -->


<color name="burlywood">#DEB887</color><!--实木色 -->


<color name="plum">#DDA0DD</color><!--洋李色 -->


<color name="gainsboro">#DCDCDC</color><!--淡灰色 -->


<color name="crimson">#DC143C</color><!--暗深红色 -->


<color name="palevioletred">#DB7093</color><!--苍紫罗兰色-->


<color name="goldenrod">#DAA520</color><!--金麒麟色 -->


<color name="orchid">#DA70D6</color><!--淡紫色 -->


<color name="thistle">#D8BFD8</color><!--蓟色 -->


<color name="lightgray">#D3D3D3</color><!--亮灰色 -->


<color name="lightgrey">#D3D3D3</color><!--亮灰色 -->


<color name="tan">#D2B48C</color><!--茶色 -->


<color name="chocolate">#D2691E</color><!--巧可力色 -->


<color name="peru">#CD853F</color><!--秘鲁色 -->


<color name="indianred">#CD5C5C</color><!--印第安红 -->


<color name="mediumvioletred">#C71585</color><!--中紫罗兰色 -->


<color name="silver">#C0C0C0</color><!--银色 -->


<color name="darkkhaki">#BDB76B</color><!--暗黄褐色 -->


<color name="rosybrown">#BC8F8F</color><!--褐玫瑰红 -->


<color name="mediumorchid">#BA55D3</color><!--中粉紫色 -->


<color name="darkgoldenrod">#B8860B</color><!--暗金黄色 -->


<color name="firebrick">#B22222</color><!--火砖色 -->


<color name="powderblue">#B0E0E6</color><!--粉蓝色 -->


<color name="lightsteelblue">#B0C4DE</color><!--亮钢兰色-->


<color name="paleturquoise">#AFEEEE</color><!--苍宝石绿 -->


<color name="greenyellow">#ADFF2F</color><!--黄绿色 -->


<color name="lightblue">#ADD8E6</color><!--亮蓝色 -->


<color name="darkgray">#A9A9A9</color><!--暗灰色 -->


<color name="darkgrey">#A9A9A9</color><!--暗灰色 -->


<color name="brown">#A52A2A</color><!--褐色 -->


<color name="sienna">#A0522D</color><!--赭色 -->


<color name="darkorchid">#9932CC</color><!--暗紫色 -->


<color name="palegreen">#98FB98</color><!--苍绿色 -->


<color name="darkviolet">#9400D3</color><!--暗紫罗兰色 -->


<color name="mediumpurple">#9370DB</color><!--中紫色 -->


<color name="lightgreen">#90EE90</color><!--亮绿色 -->


<color name="darkseagreen">#8FBC8F</color><!--暗海兰色 -->


<color name="saddlebrown">#8B4513</color><!--重褐色 -->


<color name="darkmagenta">#8B008B</color><!--暗洋红 -->


<color name="darkred">#8B0000</color><!--暗红色 -->


<color name="blueviolet">#8A2BE2</color><!--紫罗兰蓝色 -->


<color name="lightskyblue">#87CEFA</color><!--亮天蓝色 -->


<color name="skyblue">#87CEEB</color><!--天蓝色 -->


<color name="gray">#808080</color><!--灰色 -->


<color name="grey">#808080</color><!--灰色 -->


<color name="olive">#808000</color><!--橄榄色 -->


<color name="purple">#800080</color><!--紫色 -->


<color name="maroon">#800000</color><!--粟色 -->


<color name="aquamarine">#7FFFD4</color><!--碧绿色 -->


<color name="chartreuse">#7FFF00</color><!--黄绿色 -->


<color name="lawngreen">#7CFC00</color><!--草绿色 -->


<color name="mediumslateblue">#7B68EE</color><!--中暗蓝色-->


<color name="lightslategray">#778899</color><!--亮蓝灰 -->


<color name="lightslategrey">#778899</color><!--亮蓝灰 -->


<color name="slategray">#708090</color><!--灰石色 -->


<color name="slategrey">#708090</color><!--灰石色 -->


<color name="olivedrab">#6B8E23</color><!--深绿褐色 -->


<color name="slateblue">#6A5ACD</color><!--石蓝色 -->


<color name="dimgray">#696969</color><!--暗灰色 -->


<color name="dimgrey">#696969</color><!--暗灰色 -->


<color name="mediumaquamarine">#66CDAA</color><!--中绿色-->


<color name="cornflowerblue">#6495ED</color><!--菊兰色 -->


<color name="cadetblue">#5F9EA0</color><!--军兰色 -->


<color name="darkolivegreen">#556B2F</color><!--暗橄榄绿 -->


<color name="indigo">#4B0082</color><!--靛青色 -->


<color name="mediumturquoise">#48D1CC</color><!--中绿宝石-->


<color name="darkslateblue">#483D8B</color><!--暗灰蓝色 -->


<color name="steelblue">#4682B4</color><!--钢兰色 -->


<color name="royalblue">#4169E1</color><!--皇家蓝 -->


<color name="turquoise">#40E0D0</color><!--青绿色 -->


<color name="mediumseagreen">#3CB371</color><!--中海蓝 -->


<color name="limegreen">#32CD32</color><!--橙绿色 -->


<color name="darkslategray">#2F4F4F</color><!--暗瓦灰色 -->


<color name="darkslategrey">#2F4F4F</color><!--暗瓦灰色 -->


<color name="seagreen">#2E8B57</color><!--海绿色 -->


<color name="forestgreen">#228B22</color><!--森林绿 -->


<color name="lightseagreen">#20B2AA</color><!--亮海蓝色 -->


<color name="dodgerblue">#1E90FF</color><!--闪兰色 -->


<color name="midnightblue">#191970</color><!--中灰兰色 -->


<color name="aqua">#00FFFF</color><!--浅绿色 -->


<color name="cyan">#00FFFF</color><!--青色 -->


<color name="springgreen">#00FF7F</color><!--春绿色 -->


<color name="lime">#00FF00</color><!--酸橙色 -->


<color name="mediumspringgreen">#00FA9A</color><!--中春绿色 -->


<color name="darkturquoise">#00CED1</color><!--暗宝石绿 -->


<color name="deepskyblue">#00BFFF</color><!--深天蓝色 -->


<color name="darkcyan">#008B8B</color><!--暗青色 -->


<color name="teal">#008080</color><!--水鸭色 -->


<color name="green">#008000</color><!--绿色 -->


<color name="darkgreen">#006400</color><!--暗绿色 -->


<color name="blue">#0000FF</color><!--蓝色 -->


<color name="mediumblue">#0000CD</color><!--中兰色 -->


<color name="darkblue">#00008B</color><!--暗蓝色 -->


<color name="navy">#000080</color><!--海军色 -->


<color name="black">#000000</color><!--黑色 -->


</resources>

要求参考已有的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/bg_light" tools:context=".ui.activity.ServiceCategoryActivity"> <!-- 顶部状态栏占位 --> <View android:id="@+id/status_bar_placeholder" android:layout_width="match_parent" android:layout_height="0dp" android:background="@android:color/white" app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHeight_percent="0.07" /> <!-- 顶部导航栏 --> <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="@android:color/white" android:elevation="4dp" app:layout_constraintTop_toBottomOf="@id/status_bar_placeholder" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center_vertical"> <!-- 返回按钮 --> <ImageButton android:id="@+id/back_button" android:layout_width="48dp" android:layout_height="match_parent" android:background="@null" android:src="@drawable/ic_chevron_right" android:rotation="180" android:tint="@color/text_primary" android:contentDescription="返回" /> <!-- 标题 --> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:text="服务" android:textSize="18sp" android:textColor="@color/text_primary" android:fontFamily="sans-serif-black" /> </RelativeLayout> </androidx.appcompat.widget.Toolbar> <!-- 主要内容区域 --> <androidx.core.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="0dp" app:layout_constraintTop_toBottomOf="@id/toolbar" app:layout_constraintBottom_toBottomOf="parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <!-- 顶部搜索栏和门店选择 --> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/white" android:padding="16dp" android:orientation="horizontal" android:gravity="center_vertical"> <!-- 搜索框 --> <LinearLayout android:id="@+id/search_container" android:layout_width="0dp" android:layout_height="40dp" android:layout_weight="1" android:background="@drawable/search_background" android:gravity="center_vertical" android:paddingHorizontal="12dp" android:orientation="horizontal"> <ImageView android:layout_width="20dp" android:layout_height="20dp" android:src="@drawable/ic_search" android:tint="@color/text_secondary" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="8dp" android:text="搜索服务项目..." android:textSize="14sp" android:textColor="@color/text_secondary" /> </LinearLayout> <!-- 选择门店按钮 --> <LinearLayout android:id="@+id/store_select_btn" android:layout_width="wrap_content" android:layout_height="40dp" android:background="@drawable/search_background" android:gravity="center_vertical" android:paddingHorizontal="12dp" android:orientation="horizontal" android:layout_marginLeft="8dp"> <ImageView android:layout_width="20dp" android:layout_height="20dp" android:src="@drawable/ic_map_marker" android:tint="@color/primary" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="6dp" android:text="选择门店" android:textSize="14sp" android:textColor="@color/text_primary" /> </LinearLayout> </LinearLayout> <!-- 服务分类区域 --> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp" android:orientation="vertical"> <androidx.cardview.widget.CardView android:layout_width="match_parent" android:layout_height="wrap_content" app:cardCornerRadius="16dp" app:cardElevation="4dp" app:cardBackgroundColor="@android:color/white"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="24dp" android:orientation="vertical"> <!-- 标题 --> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="服务分类" android:textSize="18sp" android:textColor="@color/text_primary" android:fontFamily="sans-serif-black" android:layout_marginBottom="16dp" /> <!-- 分类网格 --> <GridLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:columnCount="2" android:rowCount="2" <!-- 洗护服务 --> <LinearLayout android:id="@+id/category_grooming" android:layout_width="0dp" android:layout_height="100dp" android:layout_columnWeight="1" android:background="@drawable/service_entrance_background" android:orientation="horizontal" android:gravity="center_vertical" android:padding="16dp" android:clickable="true" android:focusable="true" android:foreground="?attr/selectableItemBackground"> <LinearLayout android:layout_width="48dp" android:layout_height="48dp" android:background="@android:color/white" android:alpha="0.2" android:gravity="center" android:layout_marginRight="12dp"> <ImageView android:layout_width="24dp" android:layout_height="24dp" android:src="@drawable/ic_paw" android:tint="@android:color/white" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="洗护服务" android:textSize="16sp" android:textColor="@android:color/white" android:fontFamily="sans-serif-medium" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="专业清洁护理" android:textSize="12sp" android:textColor="@android:color/white" android:alpha="0.9" /> </LinearLayout> </LinearLayout> <!-- 美容造型 --> <LinearLayout android:id="@+id/category_beauty" android:layout_width="0dp" android:layout_height="100dp" android:layout_columnWeight="1" android:background="@drawable/shop_entrance_background" android:orientation="horizontal" android:gravity="center_vertical" android:padding="16dp" android:clickable="true" android:focusable="true" android:foreground="?attr/selectableItemBackground"> <LinearLayout android:layout_width="48dp" android:layout_height="48dp" android:background="@android:color/white" android:alpha="0.2" android:gravity="center" android:layout_marginRight="12dp"> <ImageView android:layout_width="24dp" android:layout_height="24dp" android:src="@drawable/ic_cut" android:tint="@android:color/white" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="美容造型" android:textSize="16sp" android:textColor="@android:color/white" android:fontFamily="sans-serif-medium" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="时尚造型设计" android:textSize="12sp" android:textColor="@android:color/white" android:alpha="0.9" /> </LinearLayout> </LinearLayout> <!-- 寄养服务 --> <LinearLayout android:id="@+id/category_boarding" android:layout_width="0dp" android:layout_height="100dp" android:layout_columnWeight="1" android:background="@drawable/pets_entrance_background" android:orientation="horizontal" android:gravity="center_vertical" android:padding="16dp" android:clickable="true" android:focusable="true" android:foreground="?attr/selectableItemBackground"> <LinearLayout android:layout_width="48dp" android:layout_height="48dp" android:background="@android:color/white" android:alpha="0.2" android:gravity="center" android:layout_marginRight="12dp"> <ImageView android:layout_width="24dp" android:layout_height="24dp" android:src="@drawable/ic_home" android:tint="@android:color/white" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="寄养服务" android:textSize="16sp" android:textColor="@android:color/white" android:fontFamily="sans-serif-medium" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="温馨托管照顾" android:textSize="12sp" android:textColor="@android:color/white" android:alpha="0.9" /> </LinearLayout> </LinearLayout> <!-- 乐园活动 --> <LinearLayout android:id="@+id/category_playground" android:layout_width="0dp" android:layout_height="100dp" android:layout_columnWeight="1" android:background="@drawable/stores_entrance_background" android:orientation="horizontal" android:gravity="center_vertical" android:padding="16dp" android:clickable="true" android:focusable="true" android:foreground="?attr/selectableItemBackground"> <LinearLayout android:layout_width="48dp" android:layout_height="48dp" android:background="@android:color/white" android:alpha="0.2" android:gravity="center" android:layout_marginRight="12dp"> <ImageView android:layout_width="24dp" android:layout_height="24dp" android:src="@drawable/ic_order" android:tint="@android:color/white" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="乐园活动" android:textSize="16sp" android:textColor="@android:color/white" android:fontFamily="sans-serif-medium" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="互动娱乐体验" android:textSize="12sp" android:textColor="@android:color/white" android:alpha="0.9" /> </LinearLayout> </LinearLayout> </LinearLayout> </LinearLayout> </LinearLayout> </androidx.core.widget.NestedScrollView> <!-- 精选服务推荐 --> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingHorizontal="16dp" android:paddingBottom="16dp" android:orientation="vertical" tools:ignore="MissingConstraints"> <!-- 标题和查看更多 --> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical" android:paddingVertical="8dp"> <TextView android:id="@+id/featured_services_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="精选服务" android:textSize="18sp" android:textColor="@color/text_primary" android:fontFamily="sans-serif-black" /> <TextView android:id="@+id/more_featured_services" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:text="查看更多" android:textSize="14sp" android:textColor="@color/primary" android:fontFamily="sans-serif-medium" android:clickable="true" android:focusable="true" android:foreground="?attr/selectableItemBackground" /> </RelativeLayout> <!-- 精选服务列表 --> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <!-- 精选服务1 --> <androidx.cardview.widget.CardView android:id="@+id/featured_service_1" android:layout_width="match_parent" android:layout_height="wrap_content" app:cardCornerRadius="16dp" app:cardElevation="2dp" app:cardBackgroundColor="@android:color/white" android:clickable="true" android:focusable="true" android:foreground="?attr/selectableItemBackground"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp" android:orientation="horizontal" android:gravity="center_vertical"> <ImageView android:layout_width="64dp" android:layout_height="64dp" android:src="@drawable/service_image_placeholder" android:scaleType="centerCrop" android:layout_marginRight="12dp" /> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="专业洗护服务" android:textSize="16sp" android:textColor="@color/text_primary" android:fontFamily="sans-serif-medium" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="深层清洁,让爱宠焕然一新" android:textSize="12sp" android:textColor="@color/text_secondary" android:layout_marginVertical="4dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="宠爱宠物医院" android:textSize="12sp" android:textColor="@color/text_secondary" /> </LinearLayout> </LinearLayout> </androidx.cardview.widget.CardView> <!-- 精选服务2 --> <androidx.cardview.widget.CardView android:id="@+id/featured_service_2" android:layout_width="match_parent" android:layout_height="wrap_content" app:cardCornerRadius="16dp" app:cardElevation="2dp" app:cardBackgroundColor="@android:color/white" android:clickable="true" android:focusable="true" android:foreground="?attr/selectableItemBackground"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp" android:orientation="horizontal" android:gravity="center_vertical"> <ImageView android:layout_width="64dp" android:layout_height="64dp" android:src="@drawable/service_image_placeholder" android:scaleType="centerCrop" android:layout_marginRight="12dp" /> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="美容造型" android:textSize="16sp" android:textColor="@color/text_primary" android:fontFamily="sans-serif-medium" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="专业造型师,打造时尚爱宠" android:textSize="12sp" android:textColor="@color/text_secondary" android:layout_marginVertical="4dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="萌宠造型屋" android:textSize="12sp" android:textColor="@color/text_secondary" /> </LinearLayout> </LinearLayout> </androidx.cardview.widget.CardView> <!-- 精选服务3 --> <androidx.cardview.widget.CardView android:id="@+id/featured_service_3" android:layout_width="match_parent" android:layout_height="wrap_content" app:cardCornerRadius="16dp" app:cardElevation="2dp" app:cardBackgroundColor="@android:color/white" android:clickable="true" android:focusable="true" android:foreground="?attr/selectableItemBackground"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp" android:orientation="horizontal" android:gravity="center_vertical"> <ImageView android:layout_width="64dp" android:layout_height="64dp" android:src="@drawable/service_image_placeholder" android:scaleType="centerCrop" android:layout_marginRight="12dp" /> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="豪华寄养" android:textSize="16sp" android:textColor="@color/text_primary" android:fontFamily="sans-serif-medium" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="24小时看护,如家般温暖" android:textSize="12sp" android:textColor="@color/text_secondary" android:layout_marginVertical="4dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="温馨宠物之家" android:textSize="12sp" android:textColor="@color/text_secondary" /> </LinearLayout> </LinearLayout> </androidx.cardview.widget.CardView> <!-- 精选服务4 --> <androidx.cardview.widget.CardView android:id="@+id/featured_service_4" android:layout_width="match_parent" android:layout_height="wrap_content" app:cardCornerRadius="16dp" app:cardElevation="2dp" app:cardBackgroundColor="@android:color/white" android:clickable="true" android:focusable="true" android:foreground="?attr/selectableItemBackground"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp" android:orientation="horizontal" android:gravity="center_vertical"> <ImageView android:layout_width="64dp" android:layout_height="64dp" android:src="@drawable/service_image_placeholder" android:scaleType="centerCrop" android:layout_marginRight="12dp" /> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="乐园互动" android:textSize="16sp" android:textColor="@color/text_primary" android:fontFamily="sans-serif-medium" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="社交游戏,快乐成长时光" android:textSize="12sp" android:textColor="@color/text_secondary" android:layout_marginVertical="4dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="宠物乐园" android:textSize="12sp" android:textColor="@color/text_secondary" /> </LinearLayout> </LinearLayout> </androidx.cardview.widget.CardView> </LinearLayout> </LinearLayout> <!-- 热门门店推荐 --> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp" android:orientation="vertical" tools:ignore="MissingConstraints"> <!-- 标题和查看更多 --> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical" android:paddingVertical="8dp"> <TextView android:id="@+id/popular_stores_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="热门门店" android:textSize="18sp" android:textColor="@color/text_primary" android:fontFamily="sans-serif-black" /> <TextView android:id="@+id/more_popular_stores" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:text="查看更多" android:textSize="14sp" android:textColor="@color/primary" android:fontFamily="sans-serif-medium" android:clickable="true" android:focusable="true" android:foreground="?attr/selectableItemBackground" /> </RelativeLayout> <!-- 热门门店列表 --> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <!-- 热门门店1 --> <androidx.cardview.widget.CardView android:id="@+id/popular_store_1" android:layout_width="match_parent" android:layout_height="wrap_content" app:cardCornerRadius="16dp" app:cardElevation="2dp" app:cardBackgroundColor="@android:color/white" android:clickable="true" android:focusable="true" android:foreground="?attr/selectableItemBackground"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp" android:orientation="horizontal" android:gravity="center_vertical"> <ImageView android:layout_width="64dp" android:layout_height="64dp" android:src="@drawable/store_image_placeholder" android:scaleType="centerCrop" android:layout_marginRight="12dp" /> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="宠爱宠物医院" android:textSize="16sp" android:textColor="@color/text_primary" android:fontFamily="sans-serif-medium" /> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingVertical="4dp"> <!-- 评分 --> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center_vertical"> <ImageView android:layout_width="12dp" android:layout_height="12dp" android:src="@drawable/ic_star" android:tint="@color/yellow_400" /> <ImageView android:layout_width="12dp" android:layout_height="12dp" android:src="@drawable/ic_star" android:tint="@color/yellow_400" /> <ImageView android:layout_width="12dp" android:layout_height="12dp" android:src="@drawable/ic_star" android:tint="@color/yellow_400" /> <ImageView android:layout_width="12dp" android:layout_height="12dp" android:src="@drawable/ic_star" android:tint="@color/yellow_400" /> <ImageView android:layout_width="12dp" android:layout_height="12dp" android:src="@drawable/ic_star" android:tint="@color/yellow_400" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="4dp" android:text="4.9分 · 1.2km" android:textSize="12sp" android:textColor="@color/text_secondary" /> </LinearLayout> </RelativeLayout> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="洗护 · 美容 · 医疗 · 寄养" android:textSize="12sp" android:textColor="@color/text_secondary" /> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/store_status_background" android:paddingHorizontal="8dp" android:paddingVertical="4dp" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="营业中" android:textSize="10sp" android:textColor="@color/primary" /> </LinearLayout> </LinearLayout> </androidx.cardview.widget.CardView> <!-- 热门门店2 --> <androidx.cardview.widget.CardView android:id="@+id/popular_store_2" android:layout_width="match_parent" android:layout_height="wrap_content" app:cardCornerRadius="16dp" app:cardElevation="2dp" app:cardBackgroundColor="@android:color/white" android:clickable="true" android:focusable="true" android:foreground="?attr/selectableItemBackground"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp" android:orientation="horizontal" android:gravity="center_vertical"> <ImageView android:layout_width="64dp" android:layout_height="64dp" android:src="@drawable/store_image_placeholder" android:scaleType="centerCrop" android:layout_marginRight="12dp" /> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="萌宠造型屋" android:textSize="16sp" android:textColor="@color/text_primary" android:fontFamily="sans-serif-medium" /> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingVertical="4dp"> <!-- 评分 --> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center_vertical"> <ImageView android:layout_width="12dp" android:layout_height="12dp" android:src="@drawable/ic_star" android:tint="@color/yellow_400" /> <ImageView android:layout_width="12dp" android:layout_height="12dp" android:src="@drawable/ic_star" android:tint="@color/yellow_400" /> <ImageView android:layout_width="12dp" android:layout_height="12dp" android:src="@drawable/ic_star" android:tint="@color/yellow_400" /> <ImageView android:layout_width="12dp" android:layout_height="12dp" android:src="@drawable/ic_star" android:tint="@color/yellow_400" /> <ImageView android:layout_width="12dp" android:layout_height="12dp" android:src="@drawable/ic_star_outline" android:tint="@color/yellow_400" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="4dp" android:text="4.7分 · 800m" android:textSize="12sp" android:textColor="@color/text_secondary" /> </LinearLayout> </RelativeLayout> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="美容 · 造型 · 洗护" android:textSize="12sp" android:textColor="@color/text_secondary" /> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/store_status_background" android:paddingHorizontal="8dp" android:paddingVertical="4dp" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="营业中" android:textSize="10sp" android:textColor="@color/primary" /> </LinearLayout> </LinearLayout> </androidx.cardview.widget.CardView> </LinearLayout> </LinearLayout> <!-- 底部间距 --> <View android:layout_width="match_parent" android:layout_height="40dp" tools:ignore="MissingConstraints" /> </androidx.constraintlayout.widget.ConstraintLayout> </androidx.core.widget.NestedScrollView> </androidx.constraintlayout.widget.ConstraintLayout>优化一下
最新发布
12-17
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值