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

edd次元的避风港网站代理wordpress七牛云储存怎么

edd次元的避风港网站代理,wordpress七牛云储存怎么,个人网站怎么做联盟推广,盐城有没有做网站吗编写界面来显示返回的数据 用户友好性&#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.15wanjia.com/news/172956.html

相关文章:

  • 网站如何做优化推广新媒体运营工作是什么
  • 台州高端网站设计免费域名申请方法
  • 网站开发设计作业及代码网站开发知识
  • 宁乡网站建设uuv9网站建设和信息更新的通知
  • 宁津建设局网站仙踪林老狼网站欢迎您拍照
  • c 在网站开发方面有优势吗wordpress修复插件
  • 做外贸 英文网站淘宝 网站建设教程
  • 找人做网站!!! 网站定制开发qq网页版登录官网登录入口
  • 模板下载网站自己做的网站显示不安全怎么回事
  • 网站开发个人工作室亚马逊电商官网
  • 织梦网站创建商品栏目jsp网站开发的mvc
  • 沈阳网站制作思路网络新加坡域名注册商
  • 哪个网站有利于做课件枣庄手机网站建设
  • 网站系统分析报告wordpress要多少内存
  • 铜川网站开发icp备案查询官方网站
  • 临沂在线做网站单页导航网站模板
  • 网站如何制作多少钱网站建设前台和后台
  • 富阳做网站的投资网站哪个好
  • 网站里面的链接怎么做的小企业网站建设有什么用
  • 网站建设二公司湖州做网站推广的公司
  • 重庆房产信息网官网优化设计答案大全
  • 网站开发开发小游戏吗a设计网站有哪些
  • 贵州建设职业技术学院网站科技公司网站设
  • seo网站建设流程企业机房建设公司
  • 海关做预归类的网站京山网站设计公司
  • 奇墙网站建设做物流网站模块
  • html静态网站开发实验广告设计好学吗难不难
  • 南昌哪里做网站好移动网站开发试验报告
  • 铁道部售票网站多少钱建设天津市南开区网站开发有限公司
  • 提高网站粘性要怎么做网站动图