How to make spinner like actionbar in native andro

2019-06-04 02:36发布

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.

enter image description here

Check for dropdown widget.

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

Many thanks.

1条回答
啃猪蹄的小仙女
2楼-- · 2019-06-04 02:55
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"

查看更多
登录 后发表回答