Changing position of Android Action Bar

久未见 提交于 2019-12-10 13:21:27

问题


I am currently changing my android app so that it supports the action bar as stated by the android development guidelines.

I've successfully created the action bar and added, what were my menu buttons to the action bar. However, the action bar is being squished up at the top next to the program name icon and instead I want to show the action bar at the bottom of the screen.

Is there a way of changing the position of the action bar? I've tried doing a Google search and looking at the dev guide, but haven't found anything.

Thanks for any help you can provide.


回答1:


Not really. And Google heavily frowns on action bars at the bottom of the screen. They will not feature your application if the action bar is anywhere but where they want it.




回答2:


According to the Layout Considerations, the ActionBar is supposed to be at the top of the screen to consistently display the app "branding" and "prominent functions" of an app. For eg: Search, Logout, etc. The bottom part of the screen is meant to show Context Menu which typically is shown when you press the "Menu" key on the device.

However, take a look at "Layout Considerations for Split Action Bars" in the above link which shows the possibility of a bottom bar to display "actions".




回答3:


The reason they don't want navigation at the bottom of the screen, is because they have the system navigation buttons there (Home, Menu, Search, and App Drawer).

On many phones these are soft buttons (no physical separation between buttons and screen). Therefore, if you encourage the user to click in that area, it is easy to "fat-finger", and launch out of your app (accidentally hitting the "Home" button for instance).

Of course, it is important to follow design standards, to make you app "fit" into the Android ecosystem, like the other posters suggested.




回答4:


android:uiOptions="splitActionBarWhenNarrow"

This option worked for me




回答5:


You need to add this in the manifest for your activity, if there are action items more than that can be accomodated in the top action bar they will be shown at the bottom

uiOptions="splitActionBarWhenNarrow"


来源:https://stackoverflow.com/questions/9132066/changing-position-of-android-action-bar

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