http://stackoverflow.com/questions/4177401/gradientdrawable-in-code
< shape android:shape="rectangle" xmlns...">
< gradient
android:startColor="#255779"
android:centerColor="#3e7492"
android:endColor="#a6c0cd"
android:angle="90" />
< stroke android:width="1dp" android:color="#0d202e" />
</shape>
int colors[] = { 0xff255779 , 0xff3e7492, 0xffa6c0cd }; GradientDrawable g = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, colors); setBackgroundDrawable(g);