List of usage examples for android.graphics.drawable ShapeDrawable setDither
@Override public void setDither(boolean dither)
From source file:com.vuze.android.remote.activity.LoginActivity.java
@SuppressWarnings("deprecation") private void setBackgroundGradient() { ViewGroup mainLayout = (ViewGroup) findViewById(R.id.main_loginlayout); assert mainLayout != null; int h = mainLayout.getHeight(); int w = mainLayout.getWidth(); View viewCenterOn = findViewById(R.id.login_frog_logo); assert viewCenterOn != null; RectShape shape = new RectShape(); ShapeDrawable mDrawable = new ShapeDrawable(shape); int color1 = AndroidUtilsUI.getStyleColor(this, R.attr.login_grad_color_1); int color2 = AndroidUtilsUI.getStyleColor(this, R.attr.login_grad_color_2); RadialGradient shader;/*ww w . ja v a2s. c om*/ if (w > h) { int left = viewCenterOn.getLeft() + (viewCenterOn.getWidth() / 2); int top = viewCenterOn.getTop() + (viewCenterOn.getHeight() / 2); int remaining = w - left; shader = new RadialGradient(left, top, remaining, new int[] { color1, color2 }, new float[] { 0, 1.0f }, Shader.TileMode.CLAMP); } else { int top = viewCenterOn.getTop() + (viewCenterOn.getHeight() / 2); shader = new RadialGradient(w / 2, top, w * 2 / 3, color1, color2, Shader.TileMode.CLAMP); } mDrawable.setBounds(0, 0, w, h); mDrawable.getPaint().setShader(shader); mDrawable.getPaint().setDither(true); mDrawable.getPaint().setAntiAlias(true); mDrawable.setDither(true); mainLayout.setDrawingCacheEnabled(true); mainLayout.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH); mainLayout.setAnimationCacheEnabled(false); mainLayout.setBackgroundDrawable(mDrawable); }