混合波纹可绘制和渐变可绘制

时间:2020-07-30 20:14:00

标签: android gradient

我一直在问一些Whatsapp小组有关在理智的视图上使用Ripple和Gradient Drawable的问题,但没人回答我。所以我想问你们是否可以在同一视图中使用它们,例如Button。这是代码:

android.graphics.drawable.RippleDrawable rName = new android.graphics.drawable.RippleDrawable(
  new android.content.res.ColorStateList(
    new int[][]{new int[]{}},
    new int[]{ Color.parseColor(_color1)}),
  new android.graphics.drawable.ColorDrawable(Color.parseColor(_color2)),
  null);

_view.setBackground(rName);
android.graphics.drawable.GradientDrawable gName = new android.graphics.drawable.GradientDrawable();
gName.setCornerRadius((float)_radius);
gName.setColor(Color.parseColor(_color));
_view.setBackground(gName);

希望有人可以帮助我

0 个答案:

没有答案