如何在android中使用setBounds实现boundCenterBottom?

如何在android中使用setBounds实现boundCenterBottom?,android,google-maps,setbounds,Android,Google Maps,Setbounds,我正在制作一个应用程序,在某个位置设置一个pin。我想在图像的底部中心的位置。我正在使用setBounds方法创建绑定,但我不确定如何将其设置为“boundCenterBottom” 我不确定这是否有效,现在无法检查,但请尝试: int dWidth = drawable.getIntrinsicWidth(); int dHeight = drawable.getIntrinsicHeight(); drawable.setBounds(-dWidth / 2, -dHeight, dWidt

我正在制作一个应用程序,在某个位置设置一个pin。我想在图像的底部中心的位置。我正在使用setBounds方法创建绑定,但我不确定如何将其设置为“boundCenterBottom”


我不确定这是否有效,现在无法检查,但请尝试:

int dWidth = drawable.getIntrinsicWidth();
int dHeight = drawable.getIntrinsicHeight();
drawable.setBounds(-dWidth / 2, -dHeight, dWidth / 2, 0);
int dWidth = drawable.getIntrinsicWidth();
int dHeight = drawable.getIntrinsicHeight();
drawable.setBounds(-dWidth / 2, -dHeight, dWidth / 2, 0);