【问题标题】:Android : How to get the textview value and compare [duplicate]Android:如何获取文本视图值并进行比较[重复]
【发布时间】:2021-08-09 21:54:03
【问题描述】:

我是新手所以 如何获取 textview 的数值并比较它是否小于 100 例如其他一些 textview 文本更改为我想要的任何内容????

例如,如果 {textview1 100} 我想将 textview2 文本更改为“Hello” else textview2 文本“再见”

我正在使用片段活动

【问题讨论】:

标签: android if-statement textview


【解决方案1】:

应该是这样的

textview2.Text = if (textview1.Text.ToInt() < 25 || textview1.Text.ToInt() > 100) "Hello" else "Goodbye"

【讨论】:

  • android studio 在 .Text 上给我红色,我也在片段活动中
猜你喜欢
  • 2015-06-18
  • 1970-01-01
  • 2022-12-15
  • 2013-08-21
  • 1970-01-01
  • 1970-01-01
  • 2022-06-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多