From 27bbd0435881e408f267c99e6a253d2e17873bcc Mon Sep 17 00:00:00 2001 From: tj <1378534974@qq.com> Date: 星期五, 11 四月 2025 17:44:11 +0800 Subject: [PATCH] 1.2 --- app/src/main/java/com/example/firstapp/adapter/PackageAdapter.kt | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/example/firstapp/adapter/PackageAdapter.kt b/app/src/main/java/com/example/firstapp/adapter/PackageAdapter.kt index 21edc63..b85bc45 100644 --- a/app/src/main/java/com/example/firstapp/adapter/PackageAdapter.kt +++ b/app/src/main/java/com/example/firstapp/adapter/PackageAdapter.kt @@ -44,16 +44,20 @@ private val textPickTime: TextView = view.findViewById(R.id.text_pick_time) fun bind(code: Code) { + + textTime.textSize=10f + textPickTime.textSize=10f + // imgCourier.setImageResource(code.category) - textCourierName.text = code.type + textCourierName.text = code.oneLevel textTrackingNumber.text = code.code // 步骤1:定义解析器,将字符串转为 Date val parser = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()) val formatter = SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault()) try { - val date: Date? = parser.parse(code.createtime) // 解析字符串 + val date: Date? = parser.parse(code.createTime) // 解析字符串 date?.let { - textTime.text = "到货:"+formatter.format(it) // 格式化并赋值 + textTime.text = "到货:"+formatter.format(it) // 格式化并赋值 } ?: run { // 处理解析失败(date 为 null 的情况) textTime.text = "Invalid Date" @@ -63,7 +67,7 @@ textTime.text = "Format Error" } try { - val date2: Date? = parser.parse(code.pickuptime) // 解析字符串 + val date2: Date? = parser.parse(code.pickupTime) // 解析字符串 date2?.let { textPickTime.text = "取件:"+formatter.format(it) // 格式化并赋值 } ?: run { -- Gitblit v1.9.3