dithering - Android background appears banded -
i'm trying set background using gradientdrawable. works fine except background appears significant banding. i've tried enable dithering, it's not getting better. here screen shot:
from coding standpoint, i've done this:
public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); /* deal gradient banding */ getwindow().setformat(pixelformat.rgba_8888); setcontentview(r.layout.activity_main); } /* attempt deal banding */ @override public void onattachedtowindow() { super.onattachedtowindow(); window window = getwindow(); window.setformat(pixelformat.rgba_8888); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.main, menu); return true; } }
and finally, xml files:
activity_main.xml
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:background="@drawable/background" tools:context=".mainactivity" > </relativelayout>
drawable/background.xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <gradient android:angle="90" android:startcolor="#999" android:endcolor="#fff" android:type="linear" android:dither="true" /> </shape>
is there way make better? thank you!
well, here have link issue, hope problem: http://www.curious-creature.org/2010/12/08/bitmap-quality-banding-and-dithering/ give awesome explanation of this.
Comments
Post a Comment