How to implement a dynamic background on ActionBar like 7x7? - android

If you have ever played 7x7 you've surely noticed the ActionBar changing his background progressively with your points until a new level is reached.
I really like the effect and I was thinking to use it somewhere. Do you have any clue on how implement it?
I'm not sure if it could be achieved drawing a Rect over it, any help?
Thanks in advance

This is my game! I actually made a custom Action Bar that was transparent and added the level progress bar underneath it.
If you wanted to use the default Action Bar, you could probably do the same with windowActionBarOverlay.

Related

View color specific to touch point

I wanna make a bar which changes to a different colour until the point where it is touched. Like this:
A seek bar will probably suit your needs very well, since you can customize the bar color, the bar itself and the progress indicator.
If you want it vertical you can probably use setRotation() (even though I'm not sure since I never actually used it I don't see why it wouldn't work).

How to position the elements in a custom action bar layout in Android?

I need to develop a custom layout for the action bar in Android.
I'm now stuck because I have no clue how to calculate the available space for my custom layout.
In the image, the red part is my custom layout, the blue part is the space occupied by the action buttons.
Clearly I need to know/calculate the size of the red part to be able to correctly position the elements in my custom action bar (for example center the title in the window or make sure not to overflow in the blue part).
How can I achieve this?
I couldn't find useful examples or a clear API in the Android documentation.
I think that anyone using the custom action bar layout must be facing this kind of problem, I'm a bit confused.
Or am I supposed not to use action buttons in this case? Perhaps I'm supposed to replicate the action buttons by myself?
Thanks in advance
Try using ToolBar instead of ActionBar. It will give you a lot more control over ActionBar elements than ActionBar.
Here is a simple tutorial about how to replace ActionBar with ToolBar and how you can customise it.
Material ToolBar
Possibilities are endless with ToolBar but my recommendation is to don't overdo anything.
As per my suggestion try to use the entire action bar by your custom layout. So that you can arrange all the things use it as a fragment inside a framelayout for all your screens so that the code can be reused for all your layouts.

How to disable shadow action bar (android 5.0)?

I am currently building an app that uses the material design theme as a base theme.
However the action bar has a dark shadow below the action bar.
I have tried everything I can think of, but I can't seem to get rid of it.
Here is a screen shot showing what I mean:
https://docs.google.com/file/d/0B_krkpxyd558V0p6a1NKZXFHeHc/edit?usp=docslist_api
If someone could tell me how I can get rid of it, I would much appreciate it.
Thanks
Corey :)
Shadow is created by using elevation, here's how you can disable it programmatically:
getActionBar().setElevation(0);

Display an ImageView above the ActionBar

I want to know, how Google does this.
I read much articles, but none of the given solutions works for me.
I dont want the Actionbar to be Transparent. I dont want to Hide the Actionbar. I dont want to Overlay the Actionbar with an ImageView like this:
https://docs.google.com/file/d/0B0T-2P7o0EFsMGF1Y2s5RjdjdUk/edit
https://docs.google.com/file/d/0B0T-2P7o0EFsQXQ3bU1kT1VPQ1E/edit
As you see in the background, the Actionbar layout isnt moved upwards, so i guess that the ActionBar is still behind the Image.
You should have no problem covering the action bar using a dialog, that's part of the reason why they exist.
There's a similar answer here with an example.

How to make application overlapping with status bar which already has transparent background in Android

I'm now customizing theme through some framework files. The problem is that I've made the status bar with transparent background. But there's an obvious side line between status bar and the application. How can I merge them together? Looks like the application align to the top of the screen but the status bar also exist.
Thanks in advance.
Please find WindowManager.LayoutParams.TYPE_STATUS_BAR in StatusBarService.java and replace it with WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY.
I think it is what you want.

Categories

Resources