Relocate Google logo in MapView

后端 未结 8 1618
迷失自我
迷失自我 2020-11-30 06:00

I have two buttons at each bottom corners of the MapView, partly obscuring the google logo in the bottom-left corner.

In order to comply with the terms

8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-30 06:28

    You can move the google logo with the help of the Tag assigned to it GoogleWatermark. In the below code i have moved it to top right corner of the screen.

    View googleLogo = binding.missionMap.findViewWithTag("GoogleWatermark");
    RelativeLayout.LayoutParams glLayoutParams = (RelativeLayout.LayoutParams)googleLogo.getLayoutParams();
    glLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0);
    glLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 0);
    glLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_START, 0);
    glLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
    glLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_END, RelativeLayout.TRUE);
    googleLogo.setLayoutParams(glLayoutParams);
    

    where missionMap is the framelayout to which the MapFragment has been added.

提交回复
热议问题