Code example for LinearGradient

Methods: setShader

0
		_paddingLeft = _paddingLeftRel * _screenWidth;
    _paddingRight = _paddingRightRel * _screenWidth;
     
    // set up background  
    // setBackgroundDrawable(getResources().getDrawable(R.drawable.wood2)); 
    final Shader backgroundShader = new LinearGradient(0, 0, 0, _screenHeight, Color.parseColor("#444448"), Color.parseColor("#111115"), TileMode.REPEAT);
    ShapeDrawable background = new ShapeDrawable(new RectShape());    
    background.getPaint().setShader(backgroundShader);
    this.setBackgroundDrawable(background);
     
    // set padding for layout 
    setPadding(10, 0, 10, 0);
		 
    card.setDetails(0, (int)_y, (int)_width);
	} 
   
	private void drawStatus(Canvas canvas, String message)
	{ 
	  canvas.drawText(message, 10, _screenHeight - 15, _statusPaint);
	}