Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Balloon-Height in XML #506

Open
vijay81 opened this issue Oct 12, 2023 · 5 comments
Open

Balloon-Height in XML #506

vijay81 opened this issue Oct 12, 2023 · 5 comments

Comments

@vijay81
Copy link

vijay81 commented Oct 12, 2023

Please complete the following information:

  • com.github.skydoves:balloon:1.6.0
  • All Android

Describe the Bug:

I used balloon with Custom layout and set width as per screen ratio but for height used BalloonSizeSpec.WRAP but balloon take default height and not adjust as per layout PFA.

Expected Behavior:

Balloon should wrap the height as per layout.

image

image

@skydoves
Copy link
Owner

Hey @vijay81 thanks for raising this issue. Would you elaborate on this issue more concisely? So you set up the height with BalloonSizeSpec.WRAP but actually the height is bigger thank your expectation? It would be also very helpful if you could provide your custom xml layout.

@vijay81
Copy link
Author

vijay81 commented Oct 16, 2023

Sure, below is my custom layout xml which is in data binding

`

<data>

    <import type="android.view.View" />

    <variable
        name="viewmodel"
        type="com.incentX.businesslogic.viewmodel.crm.pager.bottomsheet.ViewModelCRMBottoms" />

    <variable
        name="generalListener"
        type="com.incentX.businesslogic.interfaces.GeneralListener" />

    <variable
        name="generalItemListener"
        type="com.incentX.businesslogic.interfaces.GeneralItemListener" />

</data>

<androidx.constraintlayout.widget.ConstraintLayout
    android:id="@+id/root_tile_config"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:clickable="true"
    android:focusable="true"
    app:showSnackBarIcon="@{viewmodel.mIcon}"
    app:showSnackBarInt="@{viewmodel.observerSnackBarInt}"
    app:showSnackBarString="@{viewmodel.observerSnackBarString}"
    app:showSnackBarType="@{viewmodel.observerSnackBarType}">

    <LinearLayout
        android:id="@+id/linear_tile_config"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <LinearLayout
            android:id="@+id/balloon_title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/bg_square_top_corners_12"
            android:backgroundTint="@color/bg_side_menu"
            android:gravity="center_vertical"
            android:orientation="horizontal"
            android:padding="@dimen/margin_twelve">

            <TextView
                android:id="@+id/text_bottom_cancel"
                style="@style/IncentX.Text.Bold.Title.14.ColorPrimaryDark"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginEnd="@dimen/margin_eight"
                android:layout_weight="1"
                android:ellipsize="end"
                android:maxLines="1"
                android:onClick="@{generalListener::onClick}"
                android:text="@{viewmodel.observableTitle}"
                android:textSize="@dimen/textsize_eighteen" />

            <ImageView
                android:id="@+id/img_close"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginEnd="@dimen/margin_eight"
                android:contentDescription="@null"
                android:onClick="@{generalListener::onClick}"
                android:rotation="135"
                android:src="@drawable/ic_vector_add"
                app:tint="@color/bg_view_lines" />
        </LinearLayout>

        <ScrollView
            android:id="@+id/actual_view"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:scrollbars="none">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/bg_main"
                android:orientation="vertical"
                android:paddingHorizontal="@dimen/margin_sixteen"
                android:paddingBottom="@dimen/margin_twelve">

                <TextView
                    style="@style/IncentX.Text.SemiBold"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/margin_twelve"
                    android:ellipsize="end"
                    android:maxLines="1"
                    android:text="@string/text_include_in_total"
                    app:isVisible="@{viewmodel.observableIsShowIncludeInTotal}" />

                <androidx.recyclerview.widget.RecyclerView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:clipToPadding="false"
                    android:nestedScrollingEnabled="false"
                    android:orientation="horizontal"
                    android:paddingVertical="@dimen/margin_eight"
                    android:scrollbars="none"
                    app:bindGeneralItemListener="@{generalItemListener}"
                    app:bindTileConfig="@{viewmodel.observableListIncludeInTotal}"
                    app:isVisible="@{viewmodel.observableIsShowIncludeInTotal}"
                    tools:itemCount="3"
                    tools:listitem="@layout/item_tile_config" />

                <-- Other views here also -->

        </ScrollView>

        <View
            android:id="@+id/view"
            android:layout_width="match_parent"
            android:layout_height="@dimen/margin_one"
            android:background="@color/bg_view_lines"
            app:layout_constraintBottom_toTopOf="@+id/frameLayout"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent" />

        <FrameLayout
            android:id="@+id/frameLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/bg_square_bottom_corners_12"
            android:backgroundTint="@color/bg_side_menu"
            android:paddingHorizontal="@dimen/margin_sixteen"
            android:paddingVertical="@dimen/margin_twelve"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent">

            <Button
                android:id="@+id/btn_confirm"
                style="@style/IncentX.Button.Inverse.White.16"
                android:layout_width="match_parent"
                android:layout_height="@dimen/margin_forty"
                android:onClick="@{generalListener::onClick}"
                android:text="@string/text_confirm" />

        </FrameLayout>

    </LinearLayout>

    <ProgressBar
        style="@style/progressBarCentre"
        android:visibility="@{viewmodel.observerDialogProgressBar ? View.VISIBLE : View.GONE}"
        app:layout_constraintBottom_toBottomOf="@+id/linear_tile_config"
        app:layout_constraintEnd_toEndOf="@+id/linear_tile_config"
        app:layout_constraintStart_toStartOf="@+id/linear_tile_config"
        app:layout_constraintTop_toTopOf="@+id/linear_tile_config"
        tools:ignore="MissingConstraints" />

</androidx.constraintlayout.widget.ConstraintLayout>

`

@vijay81
Copy link
Author

vijay81 commented Oct 18, 2023

If anything you want from my end, let me know.

@skydoves
Copy link
Owner

skydoves commented Dec 28, 2023

Hey @vijay81, sorry for the delayed response. It seems that your custom layout can lead to misunderstanding by measuring the wrong height of the layout, especially regarding the composition of the ScrollView and RecyclerView. You should use NestedScrollView and setHasFixedSize(true) for your RecyclerView to give a hint to your layout manager to measure the expected layout size properly. I think it also would be better to specify the height size of your ScrollView or RecyclerView.

The most important thing about using a custom layout for Balloon is to give enough context to allow the popup window to measure the height size of your custom layout properly without any struggle from the end.

@vijay81
Copy link
Author

vijay81 commented Jan 10, 2024

Hey @skydoves, thanks for your response. Below are some cases which i tried after your comment

  1. Set RecyclerView height as match_parent and setHasFixedSize(true)
  2. Added all views inside NestedScrollView
  3. Set fix height size of RecyclerView and NestedScrollView

after tried above cases still height issue getting same.

NOTE:
I have multi RecyclerView in that custom layout and based on condition set data in recyclerView so everytime I'm not using all of them but based on condition recyclerView hide/show.

So please revert me back with your suggestion based on above condition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants