最近项目中有需要对百度地图Marker设置点击效果, 最开始构思使用xml布局文件
View view = View.inflate(this, R.layout.activity_b, null);
BitmapDescriptor bd = BitmapDescriptorFactory.fromView(view);
然后在marker.setIcon(bd ),一跑运行发现点击没效果。
后面看到Marker有个setAlpha属性,发现是不是可以用这个属性来模拟点击的效果
想着2个步骤:
1、点击时setAlpha调低
2、设置定时器将Alpha回归到1.0(默认Alpha为1.0)
运行Demo