If you’re just starting your adventure with ConstraintLayout, the new layout that’s available in a support library and is closely integrated with the visual UI editor in Android Studio 2.2.
What is ConstraintLayout in Android?
A ConstraintLayout in Android is a ViewGroup which allows you to position and size widgets in a flexible way. Note: ConstraintLayout is available as a support library that you can use on Android systems starting with API level 9 (Gingerbread).
In this article I’d like to highlight recent additions to ConstraintLayout in Android Studio 2.3 (Beta): chains and ratios, as well as give some general ConstraintLayout tips and tricks.
Creating chains is a new feature that lets you position views along a single axis (horizontal or vertical), that conceptually is a bit similar to a LinearLayout. As implemented by ConstraintLayout in Android, a chain is a series of views which are linked via bi-directional connections.
To create a chain in the layout editor, select the views you wish to chain together, right click on one of the views and click on “Center views horizontally” (or “Center views vertically”).
This creates the necessary connections for you. Moreover, a new button appears when you select any of the chain elements. It lets you toggle between three chain modes: Spread, Spread Inside, and Packed Chain.
There are two additional techniques you can use when dealing with chains:
If you have a Spread or Spread Inside chain and any views in the chain have their size set to MATCH_CONSTRAINT (or “0dp”), the remaining space in the chain will be distributed among them according to weights defined in layout_constraintHorizontal_weight or layout_constraintVertical_weight.
If you have a Packed chain, you can adjust the horizontal (or vertical) bias to move all elements of the chain left and right (or up and down).
Ratios let you accomplish roughly the same thing as a PercentFrameLayout, i.e. restrict a View to a set width to height ratio, without the overhead of the additional ViewGroup in your hierarchy.
To set a ratio for any view inside a ConstraintLayout:
Make sure at least one of the size constraints is dynamic, i.e. not “Fixed” and not “Wrap Content”.
Click the “Toggle aspect ratio constraint” that appears in the top left corner of the box.
Input the desired aspect ratio in width:height format, for example: 16:9
Today i am going to show you how to use GIF in Android application after my recent post on use of Springy Facebook Rebound library. Everyone know about GIF(Graphics Interchange Format) which is a great way represent your thought in single image.
I see this post on my Facebook group a member Moe Ma Ka .
Most of Android developer wants to know that how Android Instant Run works. It’s a feature in Android Studio that uses magic to significantly reduce the build and deploy times for incremental code changes during your coding / testing / debugging life-cycle.
Yes of-course, I say magic, because for the most part that’s how it looks. The first time you hit run or debug, it works like you’d expect — then each time. But you make a change and hit run or debug again (this time with a on the icon), the changes are applied before I’ve had a chance to shift my attention to my phone.
Start with this simple flow chart of a typical build cycle
The goals of Instant Run are really simple:
REMOVE AS MANY OF THESE STEPS AS POSSIBLE, AND MAKE WHATEVER REMAINS AS FAST AS POSSIBLE.
Springy Facebook Rebound is a java library that models spring dynamics. Rebound spring models can be used to create animations that feel natural by introducing real world physics to your application.
It is not a general purpose physics library; however, spring dynamics can be used to drive a wide variety of animations. The simplicity of Rebound makes it easy to integrate and use as a building block for creating more complex components like pagers, toggles, and scrollers.
Pull-to-refresh is a great place for creativity! But Yalantis building cool pull-to-refresh called Pull To Make Soup animation not only for the purpose of self-expression. These small components can actually help app publishers make their applications stand out.
Now we have a magic soup in the saucepan that cooks itself and a customizable pull-to-refresh component. I hope it encourages you to create your own super cool animations to make your apps look gorgeous.
Hope you like this idea so please share and comment us.
If you use Google Play Movies, you have probably noticed this great animated SeekBar with a preview of the movie. It turned out that Rúben Sousa implemented that as an open-source library. The gif below gives a good flavor of its functionalities.