Skip to content

Height of balloon is not calculated properly with custom layout #770

@scorpeeon

Description

@scorpeeon

Please complete the following information:

  • Library Version 1.6.11
  • Affected Device(s) - tested on multiple devices, like on emulator Pixel 9 Pro

Describe the Bug:

Hey folks, an issue I noticed is that when I set a custom layout and the height of the ballon to be wrapped:

return createBalloon(context) {
    setLayout(R.layout.tooltip)
    setHeight(BalloonSizeSpec.WRAP)

I noticed that the bottom of the text tends to get cut off.
See attached screenshot:
Screenshot 2025-01-10 at 18 47 29

When I include the same layout on a regular Android layout, I don't see any problems:
Screenshot 2025-01-10 at 18 48 05

Sample layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    android:id="@+id/container"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:background="#ff0077db">

    <View
            android:id="@+id/icon"
            android:layout_width="84dp"
            android:layout_height="84dp"
            android:padding="16dp"/>

    <LinearLayout
            android:id="@+id/text_container"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:orientation="vertical"
            android:layout_marginVertical="16dp">
        <TextView
                android:id="@+id/headline"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Sample text multiline abcqgj pjgxyz abcqgj pjgxyz"
                android:textColor="#ffffffff"
                android:textSize="17sp"/>
        <TextView
                android:id="@+id/headline_sub"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Sample text abcqgj pjgxyz abcqgj pjgxyz abcqgj pjgxyz"
                android:textColor="#ffffffff"
                android:textSize="15sp"/>
    </LinearLayout>
</LinearLayout>

The issue seems to be similar to this one:
#372
However that issue seemed to be related to supporting multiple languages, while I'm seeing this problem even for a simple use-case, using a static layout.
I don't know how the layout is constructed by the library to include the arrow icon, etc., but my feeling is that something might be off there when calculating the height in certain use-cases.

Expected Behavior:
Height should be calculated properly and content should not be cut off.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions