如何在android中创建自定义渐变?

斯堪尼亚

我想知道是否可以在android中使用这种渐变颜色?如果可能的话怎么办?http://www.techandall.com/wp-content/uploads/2013/10/techandall_mobile-analytics-UI-concept_preview1.jpg

谢谢,Bskania。

诗人
int startColor=Color.parseColor("#a6c1de");
//you can add as many gradient colors as you want here
//and include it in the int array while initializing GradientDrawable 
int endColor=Color.parseColor("#aa82b7");
GradientDrawable mDrawable=new GradientDrawable(Orientation.LEFT_RIGHT,
                                    new int[] {startColor,endColor});

LinearLayout mLayout=(LinearLayout)findViewById(R.id.your_id);
mLayout.setBackgroundDrawable(mDrawable);

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章