如何自定义从下拉微调风格的选择? [英] How to customize style from spinner dropdown CHOICES?

查看:109
本文介绍了如何自定义从下拉微调风格的选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用自定义选择的选项的背景上微调下拉菜单:

 <项目名称=机器人:spinnerStyle> @风格/ customSpinner< /项目>
<样式名称=customSpinner父=@安卓风格/ Widget.Holo.Light.Spinner>
<项目名称=机器人:文字颜色>#000000< /项目>
<项目名称=机器人:背景>#000000< /项目>
< /风格>

但我不能设法改变的下拉列表具有选项列表的背景和文本颜色。我如何做到这一点?


解决方案

  adapter.setDropDownViewResource(R.layout.custom_spinner);

custom_spinner.xml -

 <?XML版本=1.0编码=UTF-8&GT?;
<的TextView
  的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
  父=@安卓风格/ TextAppearance_Widget_DropDownItem
  机器人:文字颜色=#988767
>
< / TextView的>

I can customize the background of the selected option on a spinner dropdown using:

<item name="android:spinnerStyle">@style/customSpinner</item>
<style name="customSpinner" parent="@android:style/Widget.Holo.Light.Spinner">
<item name="android:textColor">#000000</item>
<item name="android:background">#000000</item>
</style>

But I can't manage to change the background and textcolor of the list of options that the dropdown has. How do I achieve that?

解决方案

adapter.setDropDownViewResource(R.layout.custom_spinner);

custom_spinner.xml -

<?xml version="1.0" encoding="utf-8"?>
<TextView
  xmlns:android="http://schemas.android.com/apk/res/android"
  parent="@android:style/TextAppearance_Widget_DropDownItem"
  android:textColor="#988767"
>
</TextView>

这篇关于如何自定义从下拉微调风格的选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆