Posts

Showing posts from September, 2016

Android View Collapse and Expand Animations

// To animate view slide out public void collapseView(View view) { HeightAnimation heightAnim = new HeightAnimation(view, view.getHeight(), 0 ); heightAnim.setDuration( 500 ); view.startAnimation(heightAnim); } // To animate view slide in public void expandView(View view) { HeightAnimation heightAnim = new HeightAnimation(view, 0 , ( int ) ( 51 * AppDisplayManager. getInstance ().getDeviceDensity())); heightAnim.setDuration( 200 ); view.startAnimation(heightAnim); } public class HeightAnimation extends Animation { protected final int originalHeight ; protected final View view ; protected float perValue ; public HeightAnimation(View view, int fromHeight, int toHeight) { this . view = view; this . originalHeight = fromHeight; this . perValue = (toHeight - fromHeight); } @Override protected void applyTransformation( float interpolatedTime, Transformation t) { view .getLayoutParams(). hei

Working with Android Hierarchy Viewer

Working with Hierarchy Viewer #Hierarchy Viewer allows you to debug and optimize your user interface. #It provides a visual representation of the layout's View hierarchy (the Layout View) and a magnified inspector of the display. # Connect your mobile device to your computer. # Open your application in Android Studio, build the source, and run it on your device. (debug application only) # From Android Studio, start the Android Device Monitor: Tools > Android > Android Device Monitor. # Allow USB Debugging on your phone (if asked). # Make sure your device and the package for your application are showing in the Devices (DDMS mode) or Windows (Hierarchy Viewer mode) tab. You can choose Window > Reset Perspective to get back to the default arrangement. # In Android Device Monitor (ADM), in the menu bar, choose Window > Open Perspective, and in the popup click Hierarchy View. The left dot represents the Draw Process of the rendering pipeline. - Measure Th