简体   繁体   中英

Multiple Custom Views in ActionBar

Is it possible to add multiple custom views into an Action Bar?

I tried to set two custom views in the Action Bar by using,

ActionBar.setCustomView(view);

, but it seems there is one view can be seen at a time.

Is it possible to add multiple custom views into an Action Bar?

Not directly. You can either:

  • Wrap them in a horizontal LinearLayout or something and use setCustomView()

  • Migrate one or more of them to be action views/action layouts/action providers on an <item> in the action bar

Also, bear in mind that the action bar is pretty small on phones in portrait mode, so bigger stuff may not fit all that well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM