skydoves / Balloon

:balloon: Modernized and sophisticated tooltips, fully customizable with an arrow and animations for Android.
https://skydoves.github.io/libraries/balloon/html/balloon/com.skydoves.balloon/index.html
Apache License 2.0
3.73k stars 291 forks source link

Custom layout child view width change on 1.3.1 #158

Closed Bikeskin closed 3 years ago

Bikeskin commented 3 years ago

Hi, sky, thanks for this library, it has made my job easier many times :)

Describe the Bug:

Just change lib version 1.2.9 to 1.3.1

skydoves-1 2 9 skydoves-1 3 1

Custom Layout:

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:layout_width="@dimen/toolbar_more_width" android:layout_height="wrap_content">

<TextView
    android:id="@+id/tv_more_share"
    android:layout_width="match_parent"
    android:layout_height="@dimen/toolbar_more_menu_center_item_height"
    android:fontFamily="@font/brandon_bold"
    android:background="@drawable/selector_more_list_item_center"
    android:gravity="center_vertical"
    android:layout_gravity="center"
    android:textSize="@dimen/text_size_small"
    app:drawableLeftCompat="@drawable/icon_more_share"
    android:drawablePadding="@dimen/padding_common_twice"
    android:paddingStart="@dimen/margin_large"
    android:textColor="@color/faq_result_header"
    android:text="@string/toolbar_more_share" />

<View
    android:layout_width="wrap_content"
    android:layout_height="@dimen/game_profile_separator_height"
    android:layout_marginStart="@dimen/toolbar_icon_padding"
    android:layout_marginEnd="@dimen/toolbar_icon_padding"
    android:background="@color/gray_background" />

<TextView
    android:id="@+id/tv_more_feedback"
    android:layout_width="match_parent"
    android:layout_height="@dimen/toolbar_more_menu_center_item_height"
    android:fontFamily="@font/brandon_bold"
    android:background="@drawable/selector_more_list_item_center"
    android:gravity="center_vertical"
    android:layout_gravity="center"
    android:textSize="@dimen/text_size_small"
    app:drawableLeftCompat="@drawable/icon_more_feedback"
    android:drawablePadding="@dimen/padding_common_twice"
    android:paddingStart="@dimen/margin_large"
    android:textColor="@color/faq_result_header"
    android:text="@string/toolbar_more_feedback" />

fun ...(context: Context, layout: Int): Balloon { return Balloon.Builder(context) .setArrowSize(1) .setLayout(layout) .setMarginRight(10) .setMarginTop(15) .setIsVisibleOverlay(true) .setOverlayColorResource(R.color.transparent_color_dark) .setOverlayShape(BalloonOverlayRect) .setFocusable(false) .setBackgroundColor(ContextCompat.getColor(context, R.color.white)) .setBalloonAnimation(BalloonAnimation.FADE) .build() }

skydoves commented 3 years ago

Hi, @Bikeskin! Could you share the root layout of your custom layout?

Bikeskin commented 3 years ago

Hi sky, <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:layout_width="179dp" android:layout_height="wrap_content" .... ...

skydoves commented 3 years ago

Is it the same result if you use the below method?

setWidth(179)
Bikeskin commented 3 years ago

Yes, it isn't working. But the problem was solved when i upgrade the version to 1.3.2. And we have a new problem :D Screenshot_1614081601

skydoves commented 3 years ago

Can you explain the details of the problem? And you can set the corner radius using the below method without setting the radius drawable on your custom layout.

setCornerRadius(14f)
skydoves commented 3 years ago

Hi, @Bikeskin Please reopen this issue if you face the same again :)