Removing callout's extra white space on Android

1036
3
07-30-2020 08:51 AM
HristijanPetrovski
New Contributor

Hello esri community,

I'm trying to show a callout that needs to be in the same callout window except without the extra white space that I've marked with red.

My implementation is the following

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <calloutStyle
        borderWidth="0"
        cornerRadius="20"
        leaderLength="10"
        padding = "0"
        margin = "0"
        leaderPosition="LOWER_MIDDLE"
        leaderWidth="20" />
</resources>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:orientation="vertical"
    xmlns:android="http://schemas.android.com/apk/res/android">

    <com.google.android.material.textview.MaterialTextView
        android:background="@drawable/title_layout_bg"
        android:backgroundTint="@color/colorPrimary"
        android:id="@+id/title"
        android:layout_height="wrap_content"
        android:layout_width="250dp"
        android:padding="10dp"
        android:textSize="18sp"
        android:textColor="@android:color/white" />

    <com.google.android.material.textview.MaterialTextView
        android:id="@+id/description"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:layout_width="match_parent"
        android:padding="10dp"
        android:maxLines="2"/>

    <com.google.android.material.textview.MaterialTextView
        android:layout_gravity="end"
        android:id="@+id/readMore"
        android:layout_height="wrap_content"
        android:layout_marginBottom="8dp"
        android:layout_marginEnd="16dp"
        android:layout_width="wrap_content"
        android:padding="5dp"
        android:text="@string/read_more" />

</LinearLayout>

No matter what I do there's always extra white space around the view.

Any help?

0 Kudos
3 Replies
AlanLucas
Esri Contributor

Hi Hristijan,

The Callout includes padding equal to the Corner Radius. Reducing the Corner Radius will reduce the empty space.

Hope that helps, Alan

0 Kudos
HristijanPetrovski
New Contributor

The design requirement has a cornered radius but i don't need the extra space.

0 Kudos
HristijanPetrovski
New Contributor

If i reduce the corner radius to 0 and my view is rounded, the edges that are sharp (not rounded) will be visible since they're drawn behind my custom content layout...

0 Kudos