How do I use obtain a drawable from a Shader (such as LinearGradient) so that I can use it as a background in my UI?
How do I use obtain a drawable from a Shader (such as LinearGradient )
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Since the background will probably need to resize, we will use a
ShaderFactoryto produce theShader:We use this to create a
PaintDrawablewhich we can use as a background:This is just an example and in this case it would actually be better to just declare this using XML. Look at the example here.