How to make spinner like actionbar in native android

筅森魡賤 提交于 2019-12-23 04:05:49

问题


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.


回答1:


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"



来源:https://stackoverflow.com/questions/18685011/how-to-make-spinner-like-actionbar-in-native-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!