Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 30th, 2012  |  syntax: None  |  size: 0.60 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to add a PNG image as background in Android with no alteration (banding)?
  2. android:background="@drawable/background_gradient_dithered"
  3.        
  4. <?xml version="1.0" encoding="utf-8"?>
  5. <bitmap xmlns:android="http://schemas.android.com/apk/res/android"
  6.     android:src="@drawable/background_gradient" android:dither="true" android:antialias="true" android:filter="true"/>
  7.        
  8. getWindow().setFormat(PixelFormat.RGBA_8888);
  9.        
  10. Window window = getWindow();
  11. window.setFormat(PixelFormat.RGBA_8888);
  12. window.addFlags(WindowManager.LayoutParams.FLAG_DITHER);
  13.        
  14. window.addFlags(WindowManager.LayoutParams.FLAG_DITHER);