Shadow below a Region - android

How to implement the below functionality of Gmail app for Android.
Initially the area below the text 'Mon, May 19..' does not have any shadow below it.
But when the email content is scrolled up, a shadow appears below 'Mon, May 19..' as seen in the 2nd image . Again on scrolling up, the shadow disappears.
GUI on scrolling : with shadow.
Is there any way we can get this kind of behavior in android apps?
Thanks in advance,

You can make this function with 2 different layouts and adding layout_margin="2dp" or "3dp", you can find the optimum dp value with trying. First Layout (below layout) will be your shadowed effect background, if you make its drawable resource with gradient effect.

Related

Add "Rubber Band" effect in android while changing background of application

I am working on the application in which:
User will have a control to change the background and text (multiples) by doing horizontal swipe for BG and vertical swipe for text. In this case, if I am changing BG, text should remain constant and if I am changing text then BG should remain constant.
Also, I want to add Rubber Band effect like in iOS when user changes Text and BG.
I am thinking of twoway-view library to support for vertical and horizontal scrolling. But how to use this library in my case?
Any idea/solution will be appreciated.
twoway-view implements an AdapterView that can scroll vertically or horizontally, but not both at the same time. It wouldn't work in your case.
I would use a ViewPager in which each fragment:
Shows a certain background
Lets the user select the text through swipe up and down gestures.
To obtain a rubber band effect, just add a BounceInterpolator to the animation that moves the text up & down. In the ViewPager you could get a similar effect applying a custom PageTransformer.
You will probably need to use a combination of GestureDetector, SimpleOnGestureListener and TranslateAnimation on your layout. This can be fairly involved but you can find a Translation example at this SO question and GestureDetector/SimpleOnGestureListener example here. Hopefully you can figured out how to adapt the code to suit your needs.
You can try this library for the Rubber Band effect: AndroidViewAnimations

Ignore windowSoftInputMode for certain elements eg. Background Image

My question is, is there a way to get a certain view element to ignore the windowSoftInput setting, or to set a specific setting for one view element? (Any other solutions to my problem are also welcome)
Below are more details about my problem.
I have an Android activity with a background image set to the main FrameLayout. This layout contains a few other layouts, among others a brand logo on one side, and a scrollview with edittext boxes on the other side.
Using the windowSoftInput="adjustResize" works pretty well, but it distorts the background image. Using windowSoftInput="adjustPan" however pans the brand logo out of the screen and messes with the scrollview, and the keyboard blocks the edittext boxes.
So far, looking around the web and the docs I can't find a solution, or if this is even possible. Android layouts always seem to confuse me though..

Android complex button shape

How in Android the buttons with complex shape can be done?
For example, take a look at this joystick
Each button should have several states (default, pressed, etc). It is simple to implement with regular buttons. How it can be done here?
How is it possible to create custom clicking area shape (e.g. arch shape for button "Up") that will be a bit smaller than button shape?
Look at each button individually and use a layout (such as a FrameLayout or RelativeLayout) to try and fit the pieces together. Start by making a ToggleButton and using a drawable background (`android:background="#drawable/button_background") to give it the look of one piece of the button. Do this and align all four buttons in the shape you'd like, then put place another layout behind them (with a background drawable) do complete the final piece, giving the buttons a container that makes it appear as one solid element for users.
I'm not entirely sure how you would work with the touch radius of each button... I suggest you look up other examples that work with 'odd' button shapes to hack together a working solution.
Android Custom Shape Button
I hope this points you in the right direction.
The real solution is to create own view to correctly handle such type of shapes. Custom views discussed here: https://developer.android.com/training/custom-views/index.html - you can also find some other sources on the net.

Android UI - views slider

I need an android component that will hold two views (one on top, and the second one ont he bottom). There will also be a slider between views.
It will look something like this:
View 1 is bigger than shown and user can expand it by moving down the separator (dark grey rectangle on the picture above). While expanding, View 2 will go down and will not be covered by View 1 (not like in android's notification panel).
Is there some kind of ready to use library for this? If not - could you point me in the right direction how to achieve this?
I haven't done this but I think you can scale the view by draggin. see this to know about this method.
Your question is from years ago, but I've had the same problem recently. Now that we can do nice things with the Design library with scrolling and resizing, this question has become even more important.
So I'd like to point out a library called SubAppBarPanel, that allows you to expand an area from below the app bar. When it's expanded, it pushes down the main content (see GIF).

creating a custom image based layout on android

Is it possible to create a layout based on (background) images? For example, there is well know app called Appie that uses this picture as a homescreen:
I might be able to recreate the layout with a TableLayout, but this will be difficult to get it perfectly aligned with the buttons in the image. The default layout options make it very difficult, or maybe impossible, to allow for selection of the buttons on the image (especially when the buttons are in an arc-path).
Can anyone tell me how this is done?
I had some issues positioning a badge on the corner of a view. You can check my solved question:
Positioning a badge bubble on the left upper side of a button
About how it can be done. I would do it with a RelativeLayout and TableLayout as you mentioned, but to be completely sure, you can use apktool to see how the xml are done but it might be ilegal to do it.

Categories

Resources