From 35289f12d6cb0f0db67489876c805ad4a3cbd5f6 Mon Sep 17 00:00:00 2001 From: ztenghui Date: Tue, 13 Jan 2015 16:21:11 -0800 Subject: Scaling (Animated)VectorDrawable inside ImageView Before, the VectorDrawable is behaving like BitmapDrawable inside a ImageView, and it can be blurry due to scaling. Now apply the scaling information to the cached bitmap, then the size of bitmap will match the ImageView's screen size. Therefore, no blurry any more. b/18185626 Change-Id: I979cef3b5178a9bd37ee6cc776df3361ca47c803 --- .../src/com/android/test/dynamic/ScaleDrawableTests.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/VectorDrawableTest/src/com/android/test/dynamic/ScaleDrawableTests.java b/tests/VectorDrawableTest/src/com/android/test/dynamic/ScaleDrawableTests.java index 3787843..c5be6c4 100644 --- a/tests/VectorDrawableTest/src/com/android/test/dynamic/ScaleDrawableTests.java +++ b/tests/VectorDrawableTest/src/com/android/test/dynamic/ScaleDrawableTests.java @@ -37,8 +37,8 @@ public class ScaleDrawableTests extends Activity { }; protected int icon = R.drawable.bitmap_drawable01; - protected int vector_icon = R.drawable.vector_drawable16; + protected int animated_vector_icon = R.drawable.ic_hourglass_animation; @Override protected void onCreate(Bundle savedInstanceState) { @@ -46,12 +46,12 @@ public class ScaleDrawableTests extends Activity { ScrollView scrollView = new ScrollView(this); GridLayout container = new GridLayout(this); scrollView.addView(container); - container.setColumnCount(3); + container.setColumnCount(4); container.setBackgroundColor(0xFF888888); LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); - params.width = 400; - params.height = 300; + params.width = 300; + params.height = 200; for (int i = 0; i < scaleTypes.length; i++) { TextView t = new TextView(this); @@ -71,6 +71,13 @@ public class ScaleDrawableTests extends Activity { view.setScaleType(scaleType); view.setImageResource(vector_icon); container.addView(view); + + ImageView avd_view = new ImageView(this); + avd_view.setLayoutParams(params); + avd_view.setScaleType(scaleType); + avd_view.setImageResource(animated_vector_icon); + container.addView(avd_view); + } setContentView(scrollView); -- cgit v1.1