<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How do I properly clip the mapView? in ArcGIS Runtime SDK for Android Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-do-i-properly-clip-the-mapview/m-p/19322#M124</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One of our product require two mapView; one acting as a main map for the application, while the other mapView acts as a mini-map on the top right corner, like so:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/253464_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem I am encountering is that &lt;STRONG&gt;&lt;EM&gt;I cannot properly clip the mini-map to be a circle&lt;/EM&gt;&lt;/STRONG&gt;. During my search for a solution, I have encountered numerous ways, which includes but not limited to:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Simple XML manipulation with a background with 4 rounded corners (making a circle). This did not work as it seem the mini-map mapView simply ignored its parent's parameters, making the mini map square again.&lt;/LI&gt;&lt;LI&gt;Manipulation involving a custom circle layout (Extended from ViewGroup) with onDispatch() and onDraw() overwritten to clip the provided canvas instance with a circle path instance. This gave a behaviour that I will specify below.&lt;/LI&gt;&lt;LI&gt;Clipping the custom circle layout using a ViewOutlineProvider and overriding the getOutline() method to&amp;nbsp;set the Outline instance as an oval of equal dimensions (a circle). This gave the same behaviour I mentioned above.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The&amp;nbsp;behaviour I mentioned above&amp;nbsp;is very strange and unexpected. In the event that I have the mini-map on top of the main map, the mini-map will simply ignore whatever clipping that I specified. Like so:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/253465_pastedImage_4.png" /&gt;&lt;/P&gt;&lt;P&gt;(The grey outline is the intended outline of the clipped path, while the red square represents the boundaries of the mini-map)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At first I thought it was simply because I did not set the clipping correctly. However, as I did more tests, it becomes apparent that the mini-map clipping works with every other generic type of view (e.g. FrameLayout, ImageButton), except for other mapView. This is hard to describe, so I will again use a picture. To see this, I made the main mapView half in height and aligned to the bottom, with the mini-map dipping half-way to the mapView.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-3 jive-image" src="https://community.esri.com/legacyfs/online/253483_pastedImage_6.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As it can been seen above, the mini-map will not clip with the main MapView underneath, but will clip with the regular white RelativeLayout in the background (color can be changed, and the clipping still applies). I have struggled many hours over this. An even stranger clipping behaviour will occur if I move the mini-map dynamically with a button; the clipping will clip/revert dynamically as well, depending on if it is above the main mapView.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image image-4" src="https://community.esri.com/legacyfs/online/253490_pastedImage_7.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would strong appreciate any help on this, as I could not find anything else similar to the situation I am facing. I have suggested to a senior developer that the mini-map be changed to a square, but this strongly goes against the established design, and I would like to give this one last try. Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 28 Oct 2016 14:19:55 GMT</pubDate>
    <dc:creator>GalinaTurgenev</dc:creator>
    <dc:date>2016-10-28T14:19:55Z</dc:date>
    <item>
      <title>How do I properly clip the mapView?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-do-i-properly-clip-the-mapview/m-p/19322#M124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One of our product require two mapView; one acting as a main map for the application, while the other mapView acts as a mini-map on the top right corner, like so:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/253464_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem I am encountering is that &lt;STRONG&gt;&lt;EM&gt;I cannot properly clip the mini-map to be a circle&lt;/EM&gt;&lt;/STRONG&gt;. During my search for a solution, I have encountered numerous ways, which includes but not limited to:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Simple XML manipulation with a background with 4 rounded corners (making a circle). This did not work as it seem the mini-map mapView simply ignored its parent's parameters, making the mini map square again.&lt;/LI&gt;&lt;LI&gt;Manipulation involving a custom circle layout (Extended from ViewGroup) with onDispatch() and onDraw() overwritten to clip the provided canvas instance with a circle path instance. This gave a behaviour that I will specify below.&lt;/LI&gt;&lt;LI&gt;Clipping the custom circle layout using a ViewOutlineProvider and overriding the getOutline() method to&amp;nbsp;set the Outline instance as an oval of equal dimensions (a circle). This gave the same behaviour I mentioned above.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The&amp;nbsp;behaviour I mentioned above&amp;nbsp;is very strange and unexpected. In the event that I have the mini-map on top of the main map, the mini-map will simply ignore whatever clipping that I specified. Like so:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/253465_pastedImage_4.png" /&gt;&lt;/P&gt;&lt;P&gt;(The grey outline is the intended outline of the clipped path, while the red square represents the boundaries of the mini-map)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At first I thought it was simply because I did not set the clipping correctly. However, as I did more tests, it becomes apparent that the mini-map clipping works with every other generic type of view (e.g. FrameLayout, ImageButton), except for other mapView. This is hard to describe, so I will again use a picture. To see this, I made the main mapView half in height and aligned to the bottom, with the mini-map dipping half-way to the mapView.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-3 jive-image" src="https://community.esri.com/legacyfs/online/253483_pastedImage_6.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As it can been seen above, the mini-map will not clip with the main MapView underneath, but will clip with the regular white RelativeLayout in the background (color can be changed, and the clipping still applies). I have struggled many hours over this. An even stranger clipping behaviour will occur if I move the mini-map dynamically with a button; the clipping will clip/revert dynamically as well, depending on if it is above the main mapView.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image image-4" src="https://community.esri.com/legacyfs/online/253490_pastedImage_7.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would strong appreciate any help on this, as I could not find anything else similar to the situation I am facing. I have suggested to a senior developer that the mini-map be changed to a square, but this strongly goes against the established design, and I would like to give this one last try. Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Oct 2016 14:19:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-do-i-properly-clip-the-mapview/m-p/19322#M124</guid>
      <dc:creator>GalinaTurgenev</dc:creator>
      <dc:date>2016-10-28T14:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: How do I properly clip the mapView?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-do-i-properly-clip-the-mapview/m-p/19323#M125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you share the XML that you used above so we can inspect it further?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Oct 2016 18:50:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-do-i-properly-clip-the-mapview/m-p/19323#M125</guid>
      <dc:creator>AlexanderNohe1</dc:creator>
      <dc:date>2016-10-28T18:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: How do I properly clip the mapView?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-do-i-properly-clip-the-mapview/m-p/19324#M126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear&amp;nbsp;Alexander,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I attach XML file for demonstration of strange behaviour.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 tools:context="xx.xxxxx.xxxx.MainActivity"&amp;gt;

 
 &amp;lt;!-- The mini-map. The mini-map right now has strange behaviours --&amp;gt;
 &amp;lt;LinearLayout
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:orientation="vertical"
 android:id="@+id/mini_map_layout"&amp;gt;

 &amp;lt;!-- We reserve space for application specific top bar that uses 10 percent of screen--&amp;gt;
 &amp;lt;!-- Hence we have touch space to make the mini-map use only rest 90 percent --&amp;gt;
 
 &amp;lt;FrameLayout
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:id="@+id/mini_map_touch_space"
 android:layout_weight="0.9"&amp;gt;
 &amp;lt;/FrameLayout&amp;gt;

 &amp;lt;!-- For the rest of the 90 percent of the screen --&amp;gt;
 &amp;lt;FrameLayout
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:layout_weight="0.1"
 android:id="@+id/mini_map_centering_layout"&amp;gt;

 &amp;lt;!-- Custom circle layout for mini map in center of screen. Very simple layout --&amp;gt;
 &amp;lt;xx.xxxxx.xxxx.xxxxxxx.CircleLayout
 android:layout_width="350dp"
 android:layout_height="350dp"
 android:id="@+id/mini_map"
 android:layout_gravity="center_vertical|center_horizontal"&amp;gt;
 &amp;lt;/xx.xxxxx.xxxx.xxxxxxx.CircleLayout&amp;gt;
 &amp;lt;/FrameLayout&amp;gt;
 &amp;lt;/LinearLayout&amp;gt;
 
 
 &amp;lt;!-- Map. The map will only show the bottom half for purpose of demonstration--&amp;gt;

 &amp;lt;LinearLayout
 android:orientation="vertical"
 android:layout_width="match_parent"
 android:layout_height="match_parent"&amp;gt;

 &amp;lt;!-- Usually the layout weight for the touch space is 0.9--&amp;gt;
 
 &amp;lt;FrameLayout
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:id="@+id/main_map_touch_space"
 android:layout_weight="0.5"&amp;gt;
 &amp;lt;/FrameLayout&amp;gt;

 &amp;lt;!-- Usually the layout weight for the main map is 0.1--&amp;gt;
 &amp;lt;RelativeLayout
 android:id="@+id/main_map"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:layout_gravity="fill"
 android:layout_weight="0.5"&amp;gt;
 &amp;lt;/RelativeLayout&amp;gt;
 &amp;lt;/LinearLayout&amp;gt;
&amp;lt;/RelativeLayout&amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The frames of id "main_map" and "mini_map" are loaded respectively with their mapViews. The mini map uses custom CircleLayout, which I attach below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;package xx.xxxxx.xxxx.xxxxxxx;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Path;
import android.util.AttributeSet;
import android.widget.FrameLayout;


public class CircleLayout extends FrameLayout {

 private Path mClippingPath = new Path();

 public CircleLayout(Context context) {
 super(context);

 }

 public CircleLayout(Context context, AttributeSet attributeSet){
 super(context, attributeSet);

 }

 public CircleLayout(Context context, AttributeSet attributeSet, int defStyle){
 super(context, attributeSet, defStyle);

 }

 @Override
 protected void onSizeChanged(int w, int h, int oldw, int oldh) {
 super.onSizeChanged(w, h, oldw, oldh);

 // Find the clipping path.
 float halfWidth = w / 2f;
 float halfHeight = h / 2f;

 mClippingPath.reset();
 mClippingPath.addCircle(halfWidth, halfHeight, Math.min(halfWidth, halfHeight), Path.Direction.CW);
 mClippingPath.close();

 }

 @Override
 protected void dispatchDraw(Canvas canvas) {

 int save = canvas.save();
 canvas.clipPath(mClippingPath);

 super.dispatchDraw(canvas);

 canvas.restoreToCount(save);
 }
}&lt;/PRE&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 15:55:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-do-i-properly-clip-the-mapview/m-p/19324#M126</guid>
      <dc:creator>GalinaTurgenev</dc:creator>
      <dc:date>2021-12-12T15:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: How do I properly clip the mapView?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-do-i-properly-clip-the-mapview/m-p/19325#M127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;After looking into this a bit this morning, I imagine the issue may lie somewhere with the MapSurfaceView which is part of the mapView. &amp;nbsp;I think more discussion on how to achieve this would be needed. &amp;nbsp;Additionally, I think it would be a good idea to submit an enhancement request or idea for a guide on how to make circular inset maps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Nov 2016 16:26:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-do-i-properly-clip-the-mapview/m-p/19325#M127</guid>
      <dc:creator>AlexanderNohe1</dc:creator>
      <dc:date>2016-11-08T16:26:24Z</dc:date>
    </item>
  </channel>
</rss>

