Skip to content

setVisibility not working #28

@IgnacioBasallote

Description

@IgnacioBasallote

Please complete the following information:

  • Library Version 1.0.7
  • Affected Device(s) Samsung Galaxy s9+ with Android 10.0

Describe the Bug:

The layout does not work as expected when programmatically changing its visibility. When you set the layout GONE and after an event visible again , the sizing format is completely lost.

Find here the xmls:

Main layout:

<LinearLayout
            android:id="@+id/lnlytExpandableTypeDevice"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="5dp">

            <com.skydoves.expandablelayout.ExpandableLayout
                android:id="@+id/expandableTypeDevice"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                app:expandable_duration="300"
                app:expandable_isExpanded="true"
                app:expandable_parentLayout="@layout/content_expandable_add_component_device_header"
                app:expandable_secondLayout="@layout/content_expandable_add_component_device_input"
                app:expandable_showSpinner="true"
                app:expandable_spinner="@drawable/ic_arrow_down"
                app:expandable_spinner_color="@color/StemyEnergy.Color.UI.Text.Green"
                app:expandable_spinner_animate="true"
                app:expandable_spinner_margin="14dp"
                app:expandable_spinner_gravity="end"
                app:expandable_spinner_size="40dp" />
        </LinearLayout>

parentLayout:

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/ctlyDeviceType"
    android:layout_width="match_parent"
    android:layout_height="40dp"
    android:background="@drawable/rounded_corners_button"
    android:backgroundTint="@color/StemyEnergy.Color.UI.Text.Background.Green"
    android:paddingStart="15dp"
    android:paddingEnd="15dp"
    android:layout_marginBottom="10dp">

    <TextView
        android:id="@+id/deviceType"
        android:textSize="@dimen/medium_text_size_app"
        android:textAppearance="@android:style/TextAppearance.DeviceDefault.Large"
        android:textColor="@color/StemyEnergy.Color.UI.Text.Green"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center|start"
        android:text="@string/StemyEnergy.ThirdPartyDeviceSetUp.SelectDevicePromptLbl" />

</RelativeLayout>

secondLayout:

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:padding="5dp"
    android:id="@+id/lnlyExpDeviceType">
    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/devRecyclerView"
        android:layout_width="match_parent"
        android:layout_height="140dp"
        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
        android:orientation="horizontal">
    </androidx.recyclerview.widget.RecyclerView>
</LinearLayout >

Find attached some screenshots:

  1. The second expandable layout was first set gone. After a click event it was set visible. The content of the second layout is missing (when it should not be gone) and the header format lost.

imagen

  1. Expandable layout working properly when not changing visibility:

imagen

Expected Behavior:

Visibility working as expected.

Thanks in advance!

Cheers,
Nacho

P.S. I have wrapped the expandable layouts within a LinearLayout, because is the only way of making them invisible without losing the format. However, if you set the LinearLayout visibility to GONE, the format is lost anyway.

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