Have you ever gushed over beautiful , very beautiful UI of your android apps? Sorry, most of the times these are iphone apps. That does not mean you can try to create beautiful UIs in android app. You can create a gradient background to your button of layout using xml easily. But today let us consider how it is done using code. int colors2[] = new int []{Color. CYAN , Color. WHITE ,Color. CYAN }; GradientDrawable grDr = new GradientDrawable(GradientDrawable.Orientation. TOP_BOTTOM , colors2); grDr.setCornerRadius(5); grDr.setGradientType(GradientDrawable, LINEAR_GRADIENT ); grDr.setStroke(1,Color. WHITE ); btn.setBackgroundDrawable(grDr); This is how the button would look. The code is almost self explanatory. The constructor of GradientDrawable takes the orientation of gradient and array of colors as parameter. Orientation can be top to bottom, bottom to top, left to right etc, or TL_BR or TR_BL (top left to bottom right - diagonal and to...