重新定位Google品牌徽标使其在Android上更小

时间:2019-10-03 06:28:41

标签: android google-maps

我想在我的Android应用程序上重新定位Google品牌徽标,但是每当我尝试重新定位时,徽标的大小都会减小。

我想将其重新放置在屏幕的左上角。

我正在使用以下代码重新定位。

Rect rect = new Rect();
    rlMap.getLocalVisibleRect(rect);
    googleMap.setPadding(0, 0, 0, rect.height() - 50);

如何调整Google徽标的大小并增加其大小?

预先感谢。

1 个答案:

答案 0 :(得分:0)

您可以使用此代码在左上角设置Google徽标。在onMapReady函数中设置此代码。

try {
    View googleLogo = mapLayout.findViewWithTag("GoogleWatermark");
    RelativeLayout.LayoutParams glLayoutParams = (RelativeLayout.LayoutParams) googleLogo.getLayoutParams();
    glLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0);
    glLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
    glLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_START, RelativeLayout.TRUE);
    glLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
    glLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_END, 0);
    googleLogo.setLayoutParams(glLayoutParams);
} catch (Exception e) {
    Log.e("TAG", "Can't find watermark name. Error: ", e);
}

enter image description here