Android action bar customization

my application uses the Sherlock action bar. My designer gave me a new design.

  • application logo should be in the middle
  • 2 action elements to the left and 2 actionitems to the right of the logo
  • the height of the application logo is 1.5 times the size of the action bar (it is assumed that it is a bit crowded).

Can I create a custom layout for the action bar to implement this view? or should I remove my action bar and implement the project myself?

if item # 3 is optional, does your answer change?

thanks

+6
source share
5 answers

Sorry, but hit your designer in ...

It does not have Android at all and should not be developed for Android. Either this is an ActionBar, and then you should treat as such, and you (or your designer) must follow the general scheme on Android, otherwise it is not.

If it is not an ActionBar, do not use an ActionBar (no matter which library) and create your own design that deviates enough from the ActionBar so as not to confuse users!

+38
source

Submit your designer and your manager to the Android template design site at http://developer.android.com/design/patterns/actionbar.html . Also tell them that if they want Google to ever show them, they pretty much have to stick with these. When using the full-screen layout unsuccessfully and creating a custom control on top

+3
source

I agree with the other answers: this is not the action bar defined in the Android manual.

I’ll just add that if you can’t go against design decisions (yes, projects in the real world sometimes suck, and a programmer will have to do what the client asks for).

Go with your own implementation. I suggest just creating a fragment with the corresponding listener interface (regular Android template, let the activity implement the interface, set the fragment listener in onAttach).

+2
source

If you want to implement this (and I pretty much agree with the other posters, this is non-standard and probably shouldn't be done).

You cannot create this ActionBar style with standard APIs (or ActionBarSherlock, for that matter) - since your user interface is non-standard

You can create a RelativeLayout, with your icon in the center (centerInParent = "true"). Then, in the same layout, you can create a background with the width specified as "fill_parent", and a height of up to 2/3 is the size of your center icon (calculate this value in DP).

You can then create ImageButtons for your 2 ActionItems left and right, and then just put them in the layout relative to the center icon.

On the bottom line, you probably should think about your interface in order to make it more standard for design patterns defined by Android. If you still want to do this as your designer asks, you will need to make your own layout (using RelativeLayout, as I suggested, this is one way to achieve the user interface you are looking for).

+1
source

You can create a RelativeLayout, with your icon in the center

centerInParent="true" 

Then in the same layout you can create a background with a width set to fill_parent , and a height of up to 2/3 is the size of the center icon (calculate this value in DP).

-1
source

All Articles