In Android, a feature called radial reaction exists (find it at https://material.google.com/motion/choreography.html#choreography-radial-reaction).
After a bit of research, I discovered that we can use this to reveal views (see http://android-developers.blogspot.com/2014/10/implementing-material-design-in-your.html and http://pulse7.net/android/android-create-circular-reveal-animation-and-ripple-effect-like-whatsapp/).
Is it possible to reveal a certain color, instead of a view? (For example, change the background color to red when the user clicks the layout)
For now, only revealing a view is supported out-of-the box in ViewAnimationUtils https://developer.android.com/reference/android/view/ViewAnimationUtils.html
You could have your layout file define two different background layouts (LinearLayouts for example). The circular reveal would reveal whichever view you need.
Related
I have an issue regarding design 'Setting screen' for my app. In this screen I need to design circular menu options in a triangular shape and I need to set OnClickListener only on the triangular area, which is only visible option border area. I can't understand what approach I need to use to achieve this design as well as set OnClickListener.
I added this translucent gradient background to a Toolbar so buttons are noticeable on any background, but I wonder how to make a shadow just under the button itself instead of what I did?
Thank You
EDIT
So I realized the easiest way to achieve that is by setting a Drawable Resources.
getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_home);
and
<style name="AppTheme" parent="parent_theme">
<item name="actionModeShareDrawable">#drawable/ic_share</item>
</style>
I downloaded Material Vector assets, added shadow in Adobe Illustrator, imported it to PNG. But the Android Studio's Image Asset/Action Bar and Tab Icons mess up with it I didn't get why - it removed the shadow and colors went different even with Custom 'Theme' so I did different dpi image sizes by myself and that's what I got. That's quite what I wanted
http://imgur.com/vnR98H5
Well, I don't know how to do it with simple button, if you could change Button with FloatingActionButton you may use elevation for making a shadow.
Floating Action Button (FAB) is simply a circle button with some drop shadow that unbelieveably could change the world of design. No
surprise why it becomes a signature of Material Design. So let's start
with this thing. Add FAB in layout file with FloatingActionButton and wrap it with FrameLayout since it needs some parent to make it aligned at bottom right position of the screen.
and
The shadow depth is automatically set to the best practices one, 6dp
at idle state and 12dp at pressed state. Anyway you are allowed to
override these values by defining app:elevation for idle state's
shadow depth and app:pressedTranslationZ for press state's.
From: http://inthecheesefactory.com/blog/android-design-support-library-codelab/en
Of course, you can customize by adding your icon. I'm pretty sure, that play icon as you have on button is in Material Design library.
You can also grab it here: https://design.google.com/icons/
To resume, I advice you learn something more about FloatingActionButton, which alows you to add some nice effect like elevation/shadow and others good things from Material library.
Hope it make your development easier and your app more beautiful.
Iam working on an tablet app that needs a dropdown panel that flots on top of everything inclunding my toolbar. And should look something like
Can you please suggest the best UI widget that best suits this purpose, putting into consideration elevation and alignment inside the toolbar
For me it's a PopupWindow shown with showAsDropDown. You would have to prepare a layout with highlit back button and the product list. Then create a PopupWindow with that layout set as a content.
The other option is to prepare the popup as a custom, hidden layout lying on your main screen (use FrameLayout) and change its visibility when needed.
I'm not sure, but you may need a custom ViewOutlineProvider with convex path outline. PopupWindow may be unable to drop a non-rectangular shadow like on your screenshot. In such case you would have to set its background to transparent (or maybe null?), disable window's shadow and cast shadow with custom ViewOutlineProvider.
I have start and end date time fields that look like in picture below. Blue color shows active selection - if we select right then blue color goes to right and white color appears on the left and vice versa.
Hardest part is to create that arrow style in the middle. What should i use because buttons are rectangles and I don't know how it could be done.
It's easy. Just use ninepatch.
You can start there:
http://radleymarx.com/blog/simple-guide-to-9-patch/
you need a custom image according to what you ask, maybe extend ToggleButton for that but basically what you want is the same component when pressing on two different places on the same component will dispatch different events.
I would for example extend Linear layout, make it vertical layout, put two clickable textView\buttons with 9 patch images as background ,like suggested before, one for the white part and the other for the blue part. and replace the background image for any event u like.
you can also create a StateListDrawable with actions for selected and deselected and set the state of each drawable upon the right click
How do I create a progress bar with blue progress indication, grey background and a transparent gap (black in the example) between the sections:
I've tried to play around with shapes, to create the left section with border only on the right. The closest example that I could find was shape with bottom stroke, but I was unable to modify it to display the gap required in my case.
Unless I get shape to work, I might end up using setSecondaryProgress() in code.
use setProgressDrawable, you will need to create your custom Drawable in the code as what you want cannot be done in xml, you will need to override onLevelChange and call invalidateSelf, see Custom ProgressBar for a sample implementation