From b003dd17bb16d5d5863c17bdf11679586de225a2 Mon Sep 17 00:00:00 2001 From: niushuai233 Date: Mon, 17 Oct 2022 14:14:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B0=83=E6=95=B4=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/nav/main/device/NavDeviceFragment.java | 9 ++- app/src/main/res/layout/device_item.xml | 57 +++++++++++++------ .../res/layout/main_nav_fragment_device.xml | 6 +- app/src/main/res/values/colors.xml | 2 + app/src/main/res/values/ids.xml | 9 +++ 5 files changed, 62 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/cc/niushuai/project/devcontrol/ui/nav/main/device/NavDeviceFragment.java b/app/src/main/java/cc/niushuai/project/devcontrol/ui/nav/main/device/NavDeviceFragment.java index 88c1994..7705df9 100644 --- a/app/src/main/java/cc/niushuai/project/devcontrol/ui/nav/main/device/NavDeviceFragment.java +++ b/app/src/main/java/cc/niushuai/project/devcontrol/ui/nav/main/device/NavDeviceFragment.java @@ -60,13 +60,16 @@ public class NavDeviceFragment extends Fragment { for (int i = 0; i < 3; i++) { HashMap m1 = new HashMap<>(); - m1.put("device_item_imageView", R.drawable.ic_mark_as_read); - m1.put("device_item_textView", "卧室灯" + i); + m1.put("device_item_cardView_image", R.drawable.ic_device_light_1); + m1.put("device_item_cardView_text", "卧室灯" + i); dataItem.add(m1); } +// SimpleAdapter gvAdapter = new SimpleAdapter(getContext(), dataItem, R.layout.device_item, +// new String[]{"device_item_cardView_text"}, new int[]{R.id.device_item_cardView_text}); + SimpleAdapter gvAdapter = new SimpleAdapter(getContext(), dataItem, R.layout.device_item, - new String[]{"device_item_imageView", "device_item_textView"}, new int[]{R.id.device_item_imageView, R.id.device_item_textView}); + new String[]{"device_item_cardView_image", "device_item_cardView_text"}, new int[]{R.id.device_item_cardView_image, R.id.device_item_cardView_text}); deviceGv.setAdapter(gvAdapter); } diff --git a/app/src/main/res/layout/device_item.xml b/app/src/main/res/layout/device_item.xml index 7761cc2..4a04519 100644 --- a/app/src/main/res/layout/device_item.xml +++ b/app/src/main/res/layout/device_item.xml @@ -1,25 +1,48 @@ + - + - - \ No newline at end of file + + + + + + + diff --git a/app/src/main/res/layout/main_nav_fragment_device.xml b/app/src/main/res/layout/main_nav_fragment_device.xml index 52f20f6..8eadd04 100644 --- a/app/src/main/res/layout/main_nav_fragment_device.xml +++ b/app/src/main/res/layout/main_nav_fragment_device.xml @@ -19,10 +19,14 @@ diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index f8c6127..cd2f8ae 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -7,4 +7,6 @@ #FF018786 #FF000000 #FFFFFFFF + #FFAFAFAF + #F6F6F6 \ No newline at end of file diff --git a/app/src/main/res/values/ids.xml b/app/src/main/res/values/ids.xml index 48a1b82..ec06172 100644 --- a/app/src/main/res/values/ids.xml +++ b/app/src/main/res/values/ids.xml @@ -6,4 +6,13 @@ + + + + + + + + + \ No newline at end of file