Android App Intro with Overlay - android

I would like to make a quick intro to my app for new users. The intro would highlight features in the ui and explain the functions, similar to the Slices(see screen shot below) and Youtube app.
I imagine this involves a transparent overlay of the entire screen and then getting the location of the view on the screen so it can be circled or highlighted in the overlay. I am not sure how to go about making one section of the overlay not transparent. Any ideas?

To get the effect you want in the simplest way possible you would want to create new assets and have them overlay your opaque background. This creates the illusion of the effect with out the pain of getting the dynamic way to work correctly on all devices.
The dynamic way to punch holes in a layer involves creating a custom view, overriding the dispatchDraw method and applying a custom mask to the canvas. For punching holes in the canvas, your custom paint object would be created like this:
maskPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
Compatibility isn't great with this so I'd recommend faking it.

Just add a new View() and set the background to black with 70% alpha. Make sure the Parent ViewGroup of your Fragment is a Relativelayout and the call bringChildToFront(MyHighlightedView).
overlay=new View();
overlay.setBackgroundColor(#*BLACKWITHALPHAVALUE*);
getView().addView(overlay, new LayoutParams(MATCH_PARENT,MATCH_PARENT);
getView().bringChildToFront(overlay);
getView().bringChildToFront(MyHighlightedView);

Related

Android making scale (ruler) on screen

In my application I want to create a ruler to measure length. I have gone through some ruler application in google store. I want to achieve somewhat as shown in the picture.
So my question is how do I draw this marking as per users mobile screen configuration. Is it using using some drawable image or some drawing on canvas.
I am new to android development. Also that the ruler when dragged downward marking and numbering move. So how to achieve that thing.
These kind of things that requires programmatical access to the data is mostly done using 'drawing to the canvas', which in this case is a window spawned by a service.
You should look into overlay activity implementations such as bubbles for android, which lets you peek into the way this is usually achieved, which is by creating a service that adds a window to the system that draws this, from there you can get the screen details, width and height to draw the ruler with.
Inside the spawned window you can add your own subclass of a view that implements the onDraw method in such a way that the ruler is drawn on the canvas.

Android custom UI for app

Does anybody have any idea on how to approach custom UI for an app?
I mean, there are several amazing looking apps out there, that DO NOT look like they were made using the layouts and views offered by Android.
Such as: PIE UI,
Color in the Dark, or look at this collection Collection
I basically want to know how to draw custom shapes and arrange them while making them clickable.
I know how to draw regular custom shapes, but how do I arrange them how do I make really custom shapes like parts of a circle or an ellipsis or even irregular shapes?
I know a little Photoshop, so there I can draw whatever my imagination lets me, but how do I integrate yhe images/shapes drawn there in the UI since I cannot place a shape by it's coordinates? Not all shapes can be placed inside a rectangle, because some parts might overlap. So how are they doing it?

On Android KitKat, is it possible for an overlay view to fill the entire screen?

With WindowManager.addView and WindowManager.LayoutParams, a view can be added to the screen with TYPE_SYSTEM_OVERLAY, which will then be drawn on top of all other applications. This can be used for various effects, such as colouring the screen or drawing a view which will always be visible. However, I haven't found a way for this overlay to draw over the background that's drawn behind the soft keys.
With the new options to draw in that area supported by KitKat, I figured I could try FLAG_TRANSLUCENT_NAVIGATION and FLAG_TRANSLUCENT_STATUS, but the background is still off limits. FLAG_LAYOUT_IN_SCREEN and FLAG_FULLSCREEN don't seem to help. It seems that the only way to affect the soft key background is by using FLAG_DIM_BEHIND and setting .dimAmount, but this can only be used for dimming the soft key background. Is it possible to actually draw something there, the way it is from inside an activity? If so, how could it be done?

display transparent view over existing views

In Android 2.2, I want to display a few sprites and clickable animations over an existing view. I just discovered that SurfaceView cannot be transparent
I tried overriding dispatchDraw() of a LinearLayout but that doesn't seem to be callable via a Runnable Thread.
I also tried to extend Canvas directly, but that quickly turned into a mess when trying to place it in my XML layout.
Do I have to use GLSurfaceView to have a drawing view whose background is transparent?
Optimally, I'd like to just have a Canvas on which I can draw Bitmap at various coordinates, instead of dealing with the details of GL (unless GL is the only way I can do transparency).
Silly Rabbit. Just use Views and move them around wherever you want within a FrameLayout. SurfaceView is not designed for what you're trying to do.
I'm going to try Switching from Canvas to OpenGL and toss in parts of TranslucentGLSurfaceView.
I'm still open to selecting an answer that doesn't require OpenGL, just for the sake of it solving my original question.

Android: overridePendingTransition Animation Background Color

Trying to use overridePendingTransition to apply custom animations to my activity changes. The problem is that my themed app uses colored backgrounds in the activities, and while animating a black background is visible while one view scales out and another scales in.
I would like to know if it is possible to specify the default background color here, and also if I can make it skinnable.
Any help would be greatly appreciated.
Thanks,
Josh
The animations you supply are only window animations -- they describe how to move the entire window/activity surfaces. There is no concept of a background or other such thing, just 2d transformations (and alpha fades) being applied to the entire window surface.
Further, you need to be careful when creating such animations that when you put them together the two windows are always entirely covering the screen, because there is nothing behind your application to provide a background. Thus any such animation typically needs to involve one of the windows remaining opaque if another is fading, and if they are moving they need to do so in a way that the always cover the screen as it done with the default slide left/right animation.

Categories

Resources