'Disable spinner when fragment is loading

I am displaying a list in a fragment by selecting an option from spinner. Issue is spinner is selectable when the list is loading meanwhile progress bar is showing but spinner is clickable/touchable. Spinner is outside of framelayout in a different linearlayout

<LinearLayout
    android:id="@+id/spin"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/dashbar_layout"
    android:orientation="vertical">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/text_select"
        android:textAppearance="?android:textAppearance"
        android:layout_gravity="center"
        android:textColor="@color/select_option"
        android:layout_marginTop="10dp">

    </TextView>

<com.my.Controller.SpinnerReselect
    android:overlapAnchor="false"
    android:id="@+id/date_spin"
    android:layout_width="210dp"
    android:layout_marginTop="2dp"
    android:layout_marginBottom="5dp"
    android:padding="4dp"
    android:textColor="@color/white"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal|center_vertical"
    android:spinnerMode="dropdown"
    android:background="@drawable/btn_dropdown"
    android:theme="@style/roundSpin">
</com.my.Controller.SpinnerReselect>


</LinearLayout>

    <LinearLayout
        android:orientation="horizontal"
        android:layout_below="@id/dash_spin"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <FrameLayout
            android:id="@+id/multiFrame"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

        </FrameLayout>

    </LinearLayout>

</RelativeLayout>

I tried getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE); in if else but it is enabling spinner before loading of list.



Solution 1:[1]

Resolved disabled the spinner in activity where frame layout is loading and enabled it in fragment class when loading is finished

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 tintin