Posts

Showing posts with the label Scale

Android Scale Button On Touch

Answer : Try the following: @Override public boolean onTouch(View v, MotionEvent motionEvent) { int action = motionEvent.getAction(); if (action == MotionEvent.ACTION_DOWN) { v.animate().scaleXBy(100f).setDuration(5000).start(); v.animate().scaleYBy(100f).setDuration(5000).start(); return true; } else if (action == MotionEvent.ACTION_UP) { v.animate().cancel(); v.animate().scaleX(1f).setDuration(1000).start(); v.animate().scaleY(1f).setDuration(1000).start(); return true; } return false; } This should do the trick ;)

Android Image Scale Animation Relative To Center Point

Answer : 50% is center of animated view. 50%p is center of parent <scale android:fromXScale="1.0" android:toXScale="1.2" android:fromYScale="1.0" android:toYScale="1.2" android:pivotX="50%" android:pivotY="50%" android:duration="175"/> The answer provided by @stevanveltema and @JiangQi are perfect but if you want scaling using code, then you can use my answer. // first 0f, 1f mean scaling from X-axis to X-axis, meaning scaling from 0-100% // first 0f, 1f mean scaling from Y-axis to Y-axis, meaning scaling from 0-100% // The two 0.5f mean animation will start from 50% of X-axis & 50% of Y-axis, i.e. from center ScaleAnimation fade_in = new ScaleAnimation(0f, 1f, 0f, 1f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); fade_in.setDuration(1000); // animation duration in milliseconds fade_in.setFillAfter(true); // If fillAfter is true, the tr...

Adjusting The Xcode IPhone Simulator Scale And Size

Image
Answer : With Xcode 9 - Simulator, you can pick & drag any corner of simulator to resize it and set according to your requirement. Look at this snapshot. Note: With Xcode 9.1+, Simulator scale options are changed. Keyboard short-keys : According to Xcode 9.1+ Physical Size ⌘ 1 command + 1 Pixel Accurate ⌘ 2 command + 2 According to Xcode 9 50% Scale ⌘ 1 command + 1 100% Scale ⌘ 2 command + 2 200% Scale ⌘ 3 command + 3 Simulator scale options from Xcode Menu : Xcode 9.1+: Menubar ▶ Window ▶ "Here, options available change simulator scale" ( Physical Size & Pixel Accurate ) Pixel Accurate : Resizes your simulator to actual (Physical) device's pixels, if your mac system display screen size (pixel) supports that much high resolution, else this option will remain disabled. Tip : rotate simulator ( ⌘ + ← or ⌘ + → ), if Pixel Accurate is disabled. It may be ena...