Android微调提示 [英] Android spinner prompt

查看:86
本文介绍了Android微调提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

微调器的android:prompt出现问题.我在XML文件中使用了此代码,但是它不起作用:

I have a problem with android:prompt for a spinner. I used this code in the XML file but it doesn't work:

<Spinner 
    android:id="@+id/spinner" 
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="120dp"
    android:prompt="@string/club_type">
</Spinner>

我也尝试在我的主要活动中使用此代码,但这也不起作用:

I also tried to use this code in my main activity but this doesn't work either:

spinner.setPrompt("Select club");

当我使用第二种情况时,我没有使用android:prompt;换句话说,我分别尝试了它们.有人可以帮我吗?

While I was using the second case I didn't use android:prompt; in other words, I tried them individually. Could someone help me?

推荐答案

在我的机器上完美工作.

Working perfectly on mine.

您误以为第一个元素是提示.点击微调器,您将看到Select club作为提示的标题.

You are mistaking prompt with first element. Tap on the spinner and you will see Select club as the heading which is the prompt.

希望这会有所帮助.

这篇关于Android微调提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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