Styling Sherlock Action Bar - android

I'm trying to set an image as background of the Sherlock Action Bar, but even if the it's 720 x 112 px, it seems like the image doesn't stretch.
The white part is still part of the Action Bar, as the triangle is set in the correct position and the button on the right, has different margins on the top and at the bottom.
Do I need to make it a 9patch image? Not sure why it doesn't work..
I'm setting the background with a getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.topbar));
Thanks a lot in advance for the help!

Did you put your image in hdpi or mdpi? Try switching around. Ultimately, use draw-9-patch and safe yourself a lot of headache.

Related

How big should Action Bar(Toolbar) icons be in the new Android Material design?

I tried searching the design guidelines, but I couldn't find anything related to this. I am trying to figure out the optimal size for Action bar icons in the new L release. Here is an example of what I am trying to achieve:
I tried the previous 48dp size, but it looks a lot bigger than the ones in that picture.
From Material Design Keylines Touch Target Size, size for icons is 24dp
Full icon size should be 24dp with a "live" area of 20dp.
See this answer: https://stackoverflow.com/a/14908467/3979479

Android - size (and names) of screen componants

I'm sure this will have been asked before, but I don't know how to look it up because I don't know the names of the things I'm looking for...
I'm making a live wallpaper and have a canvas which covers the whole screen. At the top of the screen, there is a bar containing tiny icons and I need to know how many pixels this is occupying because I want to avoid having the top of my displayed image being chopped off. What is this bar called, and how tall is it?
Also at the bottom of the screen there is another bar containing bigger icons - it can be scrolled sideways. What is this called and how tall is it?
After further investigation, I have seen the top bar described as a title bar, a status bar and a notification bar! I still don't know which is correct... but I did find this question which answers the most important part of my question.

Rectangular Icons in Action Bar

I need to show a rectangular icon in the ActionBar, but it resizes me to square dimensions and it becomes so tiny i can't see it.
Do anyone know a way to show it at regular rectangular size?
Thanks in advance.
Use an action view instead of a regular action item. In the layout resource you use with android:actionLayout, have an ImageView or ImageButton or something that points to your rectangular icon.

Honeycomb actionbar and margins

I'm attempting to use a different "homeAsUpIndicator" graphic on the action bar, and I'm running into some margin issues with the edge of the screen and the graphic.
Using the "android:homeAsUpIndicator" attribute with a value of #drawable/my_graphic in the styles.xml for the project, I've managed to change the indicator to a custom graphic. That graphic has been designed with a 0dp left margin in mind - as in the left edge of the graphic should go all the way to the left edge of the screen. Instead, I'm getting a 6 pixel margin on both the top and the left side the image.
I've tried setting the margins and padding in my styles.xml, but either that doesn't work or I've applied it to the wrong resource. Also, I tried setting the actionbar background to a 9-patch graphic and let the standard indicator graphic (the "<" in Honeycomb 3.1) float on top of it...that didn't work either, as it just pushed the indicator graphic to the right of the fixed pixels of the background. It only overlayed the pixels that were identified as the stretch pixels in the 9-patch.
Is there a way to remove the 6-pixel padding/margin from the actionbar so the indicator graphic is flush with the left side of the screen? Any examples or leads would be greatly appreciated!
Thank you
Have you provided drawables for different screen sizes / resolutions / densities?
Though they should resize automatically.
See here for icon design of action bar :
http://developer.android.com/guide/practices/ui_guidelines/icon_design_action_bar.html
Also you can check the standard icons being used in your sdk folder and adapt yours to those:
the path is:
ANDROID_SDK/platforms/android-XX/data/res/drawable-XXX
https://stackoverflow.com/questions/8179653/where-can-i-find-standarts-icons-for-actionbar
Otherwise check also here:
How to remove the margin between the app icon and the edge of the screen on the ActionBar?
Also you could use a custom action bar:
Custom title bar without padding (Android)

Android RatingBar problem in device

Hi I am using Rating Bar in my App. When I try it in emulator the rating bar is fully visible. (i.e) I am able to see all the five stars, but when I try it in my droid mobile, I am able to see only four stars. Can anyone suggest me a solution for this.
This can be layout issue. In droid mobile if your layout is not able to stretch properly , and you have specified certain width to rating bar, stars(layout) gets truncated. Arrange layouts using layout weights, that might solve your problem.
Do you have any padding on the RatingBar element? I just had a similar clipping issue when layout_width of my RatingBar was set to wrap_content and I had paddin_left and padding_right defined.
Removing the padding removed the clipping
The problem seemed to be because of a totally different situation.
The Default star of the Rating Bar doesn't reduce their size to adjust the layout. What ever is the screen size it has the same size(Big, small etc). So if we set the Star size to big, it will just make the star to hide from the layout. So the best solution is to make the layout size enough to fit the number of stars you are about to provide.
If not provide small style star to your Rating Bar if your layout can't accomadate big star style.

Categories

Resources