Does anyone know how to apply the ANTI_ALIAS_FLAG
to ImageView
's in layouts rather than in Java?
Asked
Active
Viewed 1.1k times
10

hichris123
- 10,145
- 15
- 56
- 70

Kevin Parker
- 16,975
- 20
- 76
- 105
2 Answers
8
You want to apply the attribute android:antialias="true"
, like so:
<ImageView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:antialias="true" />

Chris Cashwell
- 22,308
- 13
- 63
- 94
-
4android:antialias don't apply to the imageView! – Pablo Feb 05 '13 at 21:31
-
@Pablo, 2 years ago when this was answered it certainly did. Hence the OPs thankful comment and the up-votes from other users. But yeah. Thanks for pointing out that it was removed from the API nearly 2 years after the fact. – Chris Cashwell Feb 06 '13 at 06:46
-
4So, what's the solution today (in 2013)? – William Grand Sep 12 '13 at 15:40
4
2013-year-way: declare special xml resource describing ImageView's content. For example we want an ImageView to contain antialiased Bitmap. So we need to write somethig like this:
<bitmap
xmlns:android="http://schemas.android.com/apk/res/android"
android:antialias="true"
android:src="@drawable/ic_draggable_item"/>

Denis Gladkiy
- 2,084
- 1
- 26
- 40