如何使微调像动作条在原生Android [英] How to make spinner like actionbar in native android

查看:129
本文介绍了如何使微调像动作条在原生Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用动作条后,我认为,如果一个widget可以提供原生的Andr​​oid平台。 我不知道,如果我们能抓住的样式,并将其应用于从动作条API的原生窗口部件(兼容库V4)或没有。

我所问的是微调部件如下面这在动作条主要使用。

检查下拉部件。

是否可以使用本机同样喜欢在列表视图?

非常感谢。

解决方案

 适配器=新的ArrayAdapter< CharSequence的>(这一点,android.R.layout.simple_spinner_item,spinnerArrayList);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(适配器);
 

设置DropDownViewResource将工作

更重要的是: 在您的布局文件 添加后续$ C $下您的微调

风格=@安卓风格/ Widget.DeviceDefault.Light.Spinner

After using Actionbar i thought that what if same widget could be available for native android platform. I dont know if we can grab the styles and apply it to native widgets from actionbar apis(compatibility library v4) or not.

What i am asking is spinner widget like below which is mostly used in actionbar.

Check for dropdown widget.

Is it possible to use the same in native like in Listview ?

Many thanks.

解决方案

adapter = new ArrayAdapter<CharSequence>(this,android.R.layout.simple_spinner_item, spinnerArrayList);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);

Set DropDownViewResource will work

What's more: In your layout file Add the follow code for your Spinner

style="@android:style/Widget.DeviceDefault.Light.Spinner"

这篇关于如何使微调像动作条在原生Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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