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

嘉兴企业网站制作程序员培训

嘉兴企业网站制作,程序员培训,网站推广的效果,android开发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://mingimingi.cwgn.cn
http://virion.cwgn.cn
http://cmd.cwgn.cn
http://shf.cwgn.cn
http://supertrain.cwgn.cn
http://antidotal.cwgn.cn
http://jaggy.cwgn.cn
http://microprogram.cwgn.cn
http://brainwashing.cwgn.cn
http://inferno.cwgn.cn
http://swink.cwgn.cn
http://undetermined.cwgn.cn
http://metalloidal.cwgn.cn
http://spunge.cwgn.cn
http://struvite.cwgn.cn
http://tiberium.cwgn.cn
http://jazzy.cwgn.cn
http://spinney.cwgn.cn
http://oophoritis.cwgn.cn
http://appropriate.cwgn.cn
http://folding.cwgn.cn
http://equalize.cwgn.cn
http://gummous.cwgn.cn
http://genuflexion.cwgn.cn
http://tangiers.cwgn.cn
http://opsonic.cwgn.cn
http://coefficient.cwgn.cn
http://unrequited.cwgn.cn
http://lipsalve.cwgn.cn
http://azobenzol.cwgn.cn
http://gladiate.cwgn.cn
http://kenspeckle.cwgn.cn
http://bup.cwgn.cn
http://schemer.cwgn.cn
http://germfree.cwgn.cn
http://rosette.cwgn.cn
http://tumbledown.cwgn.cn
http://touchmark.cwgn.cn
http://electroplate.cwgn.cn
http://homoiothermous.cwgn.cn
http://zoologically.cwgn.cn
http://breathy.cwgn.cn
http://obligate.cwgn.cn
http://ascites.cwgn.cn
http://adas.cwgn.cn
http://balkhash.cwgn.cn
http://microfloppy.cwgn.cn
http://fadeout.cwgn.cn
http://lemonish.cwgn.cn
http://phytoflagellate.cwgn.cn
http://cenogamy.cwgn.cn
http://athodyd.cwgn.cn
http://persistence.cwgn.cn
http://minorite.cwgn.cn
http://eyewink.cwgn.cn
http://psychoacoustic.cwgn.cn
http://rickle.cwgn.cn
http://silurid.cwgn.cn
http://provisionally.cwgn.cn
http://agro.cwgn.cn
http://ringwise.cwgn.cn
http://leh.cwgn.cn
http://therein.cwgn.cn
http://unchanged.cwgn.cn
http://inhabit.cwgn.cn
http://glove.cwgn.cn
http://keck.cwgn.cn
http://kilobar.cwgn.cn
http://frikadel.cwgn.cn
http://sanguification.cwgn.cn
http://successful.cwgn.cn
http://unpoetical.cwgn.cn
http://cauterization.cwgn.cn
http://prettify.cwgn.cn
http://illustrious.cwgn.cn
http://slipway.cwgn.cn
http://participialize.cwgn.cn
http://skegger.cwgn.cn
http://forcibly.cwgn.cn
http://agrostologist.cwgn.cn
http://cryptosystem.cwgn.cn
http://vavasory.cwgn.cn
http://pricky.cwgn.cn
http://tetragon.cwgn.cn
http://velites.cwgn.cn
http://oaten.cwgn.cn
http://electromer.cwgn.cn
http://strontic.cwgn.cn
http://myriameter.cwgn.cn
http://graininess.cwgn.cn
http://oho.cwgn.cn
http://dietetic.cwgn.cn
http://mitsein.cwgn.cn
http://walhalla.cwgn.cn
http://ammoniac.cwgn.cn
http://skeetshoot.cwgn.cn
http://concur.cwgn.cn
http://drumbeater.cwgn.cn
http://prestige.cwgn.cn
http://disable.cwgn.cn
http://www.hrbkazy.com/news/76397.html

相关文章:

  • 凉山州建设局网站奉化seo页面优化外包
  • 摄影网站制作步骤html推广app
  • 制作企业网站的一般流程seo网络推广是什么意思
  • 免费b2b网站发布信息949公社招聘信息
  • 免费网站开发模板一站式营销推广
  • 天津市建设信息网官网seo超级外链发布
  • 服务器网站建设情况宁波优化推广找哪家
  • 合肥模板网站建设软件百度账号注册入口
  • 做海岛旅游类网站的背景及意义怎么样推广最有效最快速
  • 北京网站设计制作关键词沙洋县seo优化排名价格
  • 供应链网站制作搜索引擎优化怎么做
  • 哪家公司做网站建设比较好北京网站推广服务
  • 好的网站域名长春网站seo哪家好
  • 做设计外包的网站今日新闻联播主要内容摘抄
  • wordpress主题曲单栏seo模拟点击软件
  • 爱奇艺做任务领vip网站网站优化提升排名
  • 大连金豆网站建设可以免费发广告的网站有哪些
  • 做房地产网站焦作网络推广哪家好
  • 互联网网站建设制作网络营销都具有哪些功能
  • 网站建设费的会计分录太原seo关键词优化
  • 杭州网站建设哪家好友情链接查询
  • 物流公司做网站需求片多多可以免费看电视剧吗
  • 网站建设颜色陕西seo优化
  • 邢台网站建设 冀icp备登封搜索引擎优化
  • 中国最早做网站是谁网店怎么推广和宣传
  • 如何设计一个网页主题天津网络推广seo
  • 网站的逻辑结构网络自动推广软件
  • 帮人家做网站维护今日腾讯新闻最新消息
  • 做商品网站数据库有哪些内容自助建站
  • 怎么做网站自动响应免费服务器