Giter VIP home page Giter VIP logo

Comments (1)

skydoves avatar skydoves commented on July 24, 2024

Hi, thank you for your issue.
Actually it is an expected result.

The measuring size of the textView is difficult because it is changed by every device's size of letters and languages or other environments. So If we want to get the exact size of the width/height of the textView, the textView must be inflated completely.

So PopupWindow can't know the exact size of the textView. Because the layout will be inflated after showing up the PopupWindow. (The layout will be inflated on the PopupWindow.)

Fortunately, we can calculate the exact width/height size of the textView if we know the height/width size oppositely. So the basic form of the balloon (with icon and on textView) can be calculated exact height size because we know the width size of the Balloon.

Also, we can measure the exact height size of the customized popup if we know the exact width size. And there are some solutions.

1. Use fixed width/height size of the custom layout

android:layout_width="240dp"
android:layout_height="wrap_content"

or (not recommended)

android:layout_width="wrap_content"
android:layout_height="240dp"

2. Use maxWidth

By using the maxWidth attribute, the height size of the popup can be measured exactly.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:gravity="center"
  android:orientation="vertical"
  android:padding="12dp">

  <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:maxWidth="240dp"
    ...

from balloon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.