You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Affected Device(s) [emulator on API 33 and Xiaomi Mi9t Pro Api 31]
Describe the Bug:
When using WRAP height, it works with not big text but when its 6+ lines of text it crops in top or bottom.
When using Balloon.Builder.setLayout(View) together with setHeight(int height), the height is either ignored completely and causes the popup to be small.
```
val ratio = if (ScreenConfig.isPhone(activity)) 0.95f else 0.5f
val width = calculateWidth(ratio, 0)
val customView = inflateLayout()
val height = measureView(customView, width)
customView.layoutParams?.height = height
val b = getBitmapFromView(customView)
val builder = Balloon.Builder(activity)
.setLayout(customView)
.setWidthRatio(ratio)
.setHeight(height.pxToDp())
val balloon = builder.build()
private fun calculateWidth(ratio: Float, offset: Int): Int {
val displayWidth = Resources.getSystem().displayMetrics.widthPixels - offset
return (displayWidth * ratio).toInt()
}
private fun measureView(view: View, width: Int): Int {
val widthMeasureSpec = View.MeasureSpec.makeMeasureSpec(width, View.MeasureSpec.EXACTLY)
val heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)
view.measure(widthMeasureSpec, heightMeasureSpec)
view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight())
val height: Int = view.getMeasuredHeight()
return height
}
private fun inflateLayout(): View {
val inflater = activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
val view = inflater.inflate(R.layout.view_favorite_model, null)
val txtTitle = view.findViewById<TextView>(R.id.txtTitle)
val txtDescription = view.findViewById<TextView>(R.id.txtDescription)
txtDescription?.maxLines = 5
txtTitle.text = title
txtDescription.text = message
if (message.isNullOrEmpty()) {
txtDescription.visibility = View.GONE
} else {
txtDescription.visibility = View.VISIBLE
}
txtDescription?.setOnClickListener {
action?.invoke()
}
val lp = FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT)
view.layoutParams = lp
return view
}
Please complete the following information:
Describe the Bug:
When using WRAP height, it works with not big text but when its 6+ lines of text it crops in top or bottom.

When using Balloon.Builder.setLayout(View) together with setHeight(int height), the height is either ignored completely and causes the popup to be small.

Expected Behavior:
I want to view measure correctly or Balloon stop ignoring setHeight.
The text was updated successfully, but these errors were encountered: