【问题标题】:How to change the color of the selected item of a spinner [duplicate]如何更改微调器所选项目的颜色[重复]
【发布时间】:2018-03-15 23:16:11
【问题描述】:

如何更改微调器的文本颜色,即下拉按钮左侧的文本? (图中“丹麦”)

【问题讨论】:

标签: android layout styles spinner textcolor


【解决方案1】:

你必须这样尝试

public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
   TextView selectedText = (TextView) parent.getChildAt(0);
   if (selectedText != null) {
      selectedText.setTextColor(Color.RED);
   }
}

【讨论】:

  • 工作得很好:)
  • 你可以吗?
猜你喜欢
  • 2013-03-01
  • 1970-01-01
  • 2016-11-25
  • 2018-04-19
  • 1970-01-01
  • 1970-01-01
  • 2014-11-18
  • 1970-01-01
  • 2020-04-27
相关资源
最近更新 更多