当我触摸布局的边框(使用RippleDrawable作为背景的线性布局)时,涟漪效果不会在点击的点开始,而是在 波纹也传播到中心。
RippleDrawable drawable = new RippleDrawable(ColorStateList.valueOf(pressedColor), null, getRippleMask(baseColor));
this.setBackground(drawable);
我还尝试使用setHotspot
方法作为坐标(0,0)并且它不会从左上角开始。
答案 0 :(得分:0)
尝试这种方法可能对你有用
private void startRippleAnimation(View v, float x, float y){
Drawable background = v.getBackground();
if(background instanceof RippleDrawable){
RippleDrawable ripple = (RippleDrawable)background;
ripple.setHotspot(x, y);
ripple.setVisible (true, true);
}
}
答案 1 :(得分:0)
在setHotspotBound(x,y,x,y)
setHotspot(x,y)
方法解决