i try to draw LinearGradient in a layout but the gradient is not fit into my view.
Instead of gradient i see only one color.
I think its because im not giving the right dimension of the view
Here is my code:
backGroundColorView = (LinearLayout) findViewById(R.id.backGroundColorView);
int[] tempColors = data.getAppBackgroundColor();
LinearGradient test = new LinearGradient(0.f, 0.f, backGroundColorView.getWidth(), backGroundColorView.getHeight(), tempColors, null, TileMode.CLAMP);
ShapeDrawable shape = new ShapeDrawable(new RectShape());
shape.getPaint().setShader(test);
backGroundColorView.setBackgroundDrawable(shape);
Thank for helping