当前位置: 首页 > news >正文

路由硬盘做网站空间不19手机网站

路由硬盘做网站空间不,19手机网站,企业免费自助建站系统,公众号平台app编写界面来显示返回的数据 用户友好性&#xff1a;通过界面设计和用户体验优化&#xff0c;可以使天气信息更易读、易理解和易操作。有效的界面设计可以提高用户满意度并提供更好的交互体验。 增加城市名字的TextView <TextViewandroid:id"id/textViewCityName"…

编写界面来显示返回的数据

用户友好性:通过界面设计和用户体验优化,可以使天气信息更易读、易理解和易操作。有效的界面设计可以提高用户满意度并提供更好的交互体验。

增加城市名字的TextView

    <TextViewandroid:id="@+id/textViewCityName"android:layout_width="wrap_content"android:layout_height="wrap_content"android:width="200dp"android:height="50dp"app:layout_constraintTop_toBottomOf="@+id/buttonSearch"app:layout_constraintStart_toStartOf="parent"app:layout_constraintEnd_toEndOf="parent"android:textSize="20sp"android:gravity="center"/>
  • android:id="@+id/textViewCityName":给 TextView 设置了一个唯一的标识符,以便于在代码中对其进行引用。
  • android:layout_width="wrap_content" android:layout_height="wrap_content":设置 TextView 的宽度和高度分别根据文本内容自动调整。
  • android:width="200dp" android:height="50dp":指定 TextView 的宽度和高度为 200dp 和 50dp。
  • app:layout_constraintTop_toBottomOf="@+id/buttonSearch":将 TextView 的顶部与 id 为 buttonSearch 的视图的底部对齐。
  • app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent":将 TextView 的左侧与父容器的左侧对齐,将 TextView 的右侧与父容器的右侧对齐。
  • android:textSize="20sp":设置 TextView 的文本字体大小为 20sp。
  • android:gravity="center":将文本内容在 TextView 中水平和垂直居中。

增加温度显示部分

    <TextViewandroid:id="@+id/textViewTemperature"android:layout_width="wrap_content"android:layout_height="wrap_content"app:layout_constraintTop_toBottomOf="@+id/textViewCityName"app:layout_constraintStart_toStartOf="parent"app:layout_constraintEnd_toEndOf="parent"android:textSize="30sp"android:gravity="center"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"app:layout_constraintTop_toTopOf="@+id/textViewTemperature"app:layout_constraintStart_toEndOf="@id/textViewTemperature"android:text="@string/degree"android:textSize="20sp"android:gravity="center" /><TextViewandroid:id="@+id/textViewMaxMinTemperature"android:layout_width="wrap_content"android:layout_height="wrap_content"app:layout_constraintTop_toBottomOf="@id/textViewTemperature"app:layout_constraintStart_toStartOf="parent"app:layout_constraintEnd_toEndOf="parent"android:textSize="12sp"android:gravity="center" />

增加天气内容

    <TextViewandroid:id="@+id/textViewWeather"android:layout_width="wrap_content"android:layout_height="wrap_content"app:layout_constraintTop_toBottomOf="@id/textViewMaxMinTemperature"app:layout_constraintStart_toStartOf="parent"app:layout_constraintEnd_toEndOf="parent"android:textSize="20sp"android:gravity="center" />

编写逻辑填充数据

    @SuppressLint("SetTextI18n")@Subscribe(threadMode = ThreadMode.MAIN)fun onEvent(event: WeatherResponseEvent) {val weatherResponse = event.weatherResponseval kelvins = 273.15val cityName = weatherResponse.nameval temperature = weatherResponse.main?.temp?.minus(kelvins)val maxTemperature = weatherResponse.main?.temp_max?.minus(kelvins)val minTemperature = weatherResponse.main?.temp_min?.minus(kelvins)findViewById<TextView>(R.id.textViewCityName).text = cityNamefindViewById<TextView>(R.id.textViewTemperature).text = temperature?.toInt().toString()findViewById<TextView>(R.id.textViewMaxMinTemperature).text = "${maxTemperature?.toInt()} / ${minTemperature?.toInt()}"findViewById<TextView>(R.id.textViewWeather).text = "${weatherResponse.weather.first().main} | ${weatherResponse.weather.first().description}"}

最后的效果:

在这里插入图片描述

http://www.yayakq.cn/news/460395/

相关文章:

  • 建设网站员工招聘策划方案at结尾网站
  • 四川省优质校建设 网站文创产品设计方案
  • 网站建设有哪些软件网易黄页
  • 电商网站运营建设的目标三明做网站的公司
  • 建设网站q8555 3807云电脑注册网站首页
  • 贵阳网站app制作百度做自己的网站
  • 怎么制作一个网站教程php mysql 网站开发实例教程
  • 济南seo网站优化网页设计尺寸要缩进多少
  • 教学网站模板摄影婚纱网站建设
  • 如何自建网站视频网站建设多少钱宋柯
  • 江宁网站建设价格九宫格导航网站
  • 怎么健手机网站手机商城怎么做
  • 可以做视频片头的网站创业加盟
  • 网站建设对企业的好处残联网站建设方案
  • 桂阳网站设计免费数据库网站空间
  • 如何做网站 写代码wordpress controls
  • 网站域名注册后怎么建设安装wordpress空白
  • 苏州制作企业网站公司劳动局免费培训项目
  • h5网站和传统网站区别合肥公司建设网站
  • 如何用域名建网站吉安哪家网站建设公司好
  • 如何做镜像网站建设网站公司哪里好
  • 织梦如何建设网站首页广州市建设和水务局网站
  • 国外工程建筑网站怎么注册公司流程和费用
  • 可做市值曲线的网站wordpress divi 2.5
  • 软考培训机构哪家好一点长春seo网站排名优化
  • 揭阳建设局网站淘宝网站c#设计怎么做
  • 怎么看网站用什么代码做的个人怎么创建微信公众号
  • 网站建设费用是多少钱网站后台英文
  • 泸州中泸建设集团有限公司网站怎么找到网站站长
  • wordpress 朴素泰州网站建设方案优化