It is necessary to set the current position at the bottom of the zoom buttons with the reference to the first one so that the indent does not change at different resolutions. How to do it?
1 answer
This can be done in two ways:
- Hellish hacks by finding the buttons in the map container and giving them the desired location. Here is an example for a compass button:
/** * hack for moving compas */ public static void moveCompas(final View mapView) { try { final ViewGroup parent = (ViewGroup) mapView.findViewWithTag("GoogleMapMyLocationButton").getParent(); parent.post(new Runnable() { @Override public void run() { try { Resources r = mapView.getResources(); //convert our dp margin into pixels int marginPixels = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, r.getDisplayMetrics()); //increase top as we have search int marginPixelsTop = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20 + 64, r.getDisplayMetrics()); // Get the map compass view View mapCompass = parent.getChildAt(4); // create layoutParams, giving it our wanted width and height(important, by default the width is "match parent") RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams(mapCompass.getHeight(), mapCompass.getHeight()); // position on top right rlp.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 0); rlp.addRule(RelativeLayout.ALIGN_PARENT_TOP); rlp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); rlp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0); //give compass margin rlp.setMargins(marginPixels, marginPixelsTop, marginPixels, marginPixels); mapCompass.setLayoutParams(rlp); } catch (Exception ex) { ex.printStackTrace(); } } }); } catch (Exception ex) { Log.ex(TAG, ex.getMessage(), ex); } } The rest of the buttons should be done in the same way and bear in mind that when updating the SDK cards, all this can change and you have to re-write these hacks
- Replace buttons with your own implementation. Those. Take and place your buttons on top of the card and implement the necessary functionality.
SDK cards do not provide the functionality you need and without much pain you can’t solve your problem
- Thank! I will use custom view - Taras Zhupnik
|