本文介绍了如何设置微调提示的样式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经成功地设计了微调背景,如下所示:如何以编程方式将字体自定义字体设置为 Spinner 文本?

I have successfully styled spinner background like here: How to set font custom font to Spinner text programmatically?

我打开的微调器看起来像这样:

My opened spinner looks like this:

唯一剩下的样式是微调提示框(和里面的文本).如何更改微调提示的背景颜色和字体?

Only thing that is left to style is spinner prompt box (and text inside). How can i change background color and font of spinner prompt?

基于 2red13 建议,我创建了样式:

Based on 2red13 advice i created style:

<?xml version="1.0" encoding="utf-8"?>
 <resources>
<style name="spinner_style">
    <item name="android:layout_width">fill_parent</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:textColor">#00FF00</item>
    <item name="android:typeface">monospace</item>
    <item name="android:background">#8b4513</item>
</style>

并像这样将它应用到微调器上:

and aplied it to spinner like this:

 <Spinner
    android:id="@+id/spinner"
     style="@style/spinner_style"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:prompt="@string/header_prompt"
    android:background="@drawable/spinaca"
    android:layout_margin="5dip"/>

但是什么都没有改变.我想我不明白什么:(

But nothing has changed. I guess i don't understand something :(

推荐答案

样式定义如下:

style="?android:attr/spinnerItemStyle"

你必须建立自己的风格并将其设置为上述内容

you have to build your own style and set it instaed of the above

这篇关于如何设置微调提示的样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-18 00:03
查看更多