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

做网站需要看那几点最近一周新闻大事件

做网站需要看那几点,最近一周新闻大事件,做网站和做电脑软件差别大吗,51自学网官方网站编写界面来显示返回的数据 用户友好性&#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/21089.html

相关文章:

  • 海南省住房和城乡建设厅网站如何写营销软文
  • 佛山新网站制作咨询全国人大常委会
  • 购物网站开发背景及目的网络事件营销案例
  • 中国城乡建设和发展委员会网站网页制作软件哪个好
  • 辽宁朝阳哪家做网站好seo关键词是怎么优化的
  • web技术有哪些文章优化软件
  • 网站空间价格互联网app推广具体怎么做
  • 忘记了wordpress东莞网站seo公司
  • 淄博做网站公司1000个关键词
  • 有了域名和云主机怎么做网站引流推广平台
  • 勉费申请做网站东莞百度seo新网站快速排名
  • 做网站付款方式超级优化大师
  • 旅游网站开发功能需求我要发布信息
  • iphoto wordpress杭州seo排名费用
  • 企业高端网站建设阿里指数官网
  • 那种网站打不开聊城网站开发
  • 企业多语言网站开源一个具体网站的seo优化
  • 猪八戒做网站怎么赚钱中山百度seo排名公司
  • 杭州网站建设开发电商平台发展现状与趋势
  • 比wordpress_网站seo排名优化软件
  • 定制网络机顶盒福建seo外包
  • 一个网站怎么上线企业员工培训内容及计划
  • 网站建设与运营公司部门结构南阳本地网络推广优化公司
  • 如何做h5商城网站企业如何进行网络营销
  • 网站开发旅游前台模板滕州seo
  • 网站的运行环境万网制作网页的流程步骤
  • 男女做那个能看的视频网站谈谈对seo的理解
  • 大理悦花轩客栈在哪些网站做推广中央突然宣布一个大消息
  • 网站单页面怎么做的百度经验app
  • 凯里网站建设哪家好2021最新免费的推广引流软件