Nested expandable listview in android
Asked Answered
A

2

9

I have implemented expandable listview using this tutorial:

But my requirement is to create a nested expandable listview. Something like this:

Movies
  Hollywood
    Coming Soon
      abc1
      abc2
      abc3
    Now Showing
      abc1
      abc2
      abc3
  Bollywood
    Coming Soon
      abc1
        vcvc
        vcvc
        (..many more levels)
      abc2
      abc3
    Now Showing
      abc1
      abc2
      abc3

If someone has implemented this before, please share.
Thanks in advance.

Autogiro answered 21/10, 2013 at 6:16 Comment(1)
Checkout github.com/shahbazhashmi/nested-expandable-recyclerviewAmias
B
0

I have an idea, but I don't know its proper or not.

At first, use TextView for headers like Hollywood, Bollywood, Coming Soon, and for others too excepts in last second nested list. Use ExpandableListView for last second nested list. In your case-

Movies    //Tv
  Hollywood    //Tv
    Coming Soon  //  --
      abc1       //   |
      abc2       //   |
      abc3       //   |  ExpandableLV
    Now Showing  //   |
      abc1       //   |
      abc2       //   |
      abc3       //  --
  Bollywood    //Tv
    Coming Soon    //Tv     
      abc1    //Tv          
        vcvc    //Tv
        vcvc                  //    -
                              //     |  ExpandableLV
        (..many more levels)  //    - 
      abc2    //Tv
      abc3    //Tv
    Now Showing // -
      abc1      //  |
      abc2      //  |  ExpandableLV
      abc3      // -

Now you would wonder how stupid is this. You want to give the whole list expandable effect. So that's why I got a solution for it too.

Use Visibility feature for all Textviews. Whenever any particular Textview's OnClickListener listener is called, toggle Visibility of inner data.

E.g. In your case - when Movies is clicked, call HollywoodTextview.setVisibility(View.VISIBLE); and BollywoodTextview.setVisibility(View.VISIBLE);. And then when HollywoodTextview is clicked, call HollywoodComingSoonNowShowingExpandableLV.setVisibility(View.VISIBLE);. Similarly, keep toggling as required. I hope this helps.

Note: you might come across a scrolling problem bacause of manual scrollbars you would use and inbuilt scrolls of ExpandableListView. See if you can tackle it. Pleasure!

Biochemistry answered 27/5, 2015 at 6:0 Comment(0)
H
-1
out_marginLeft="50dp"
            android:layout_marginTop="50dp"
            android:layout_marginRight="50dp"
            android:gravity="center"
            android:orientation="vertical">

            <ProgressBar
                android:id="@+id/progressBar"
                style="?android:attr/progressBarStyleHorizontal"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_above="@+id/txtProgress"
                android:layout_centerHorizontal="true"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:progress="50"
                android:progressTint="@android:color/black" />

            <TextView
                android:id="@+id/txtProgress"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="8dp"
                android:text="Progress"
                android:textColor="@android:color/black" />
        </LinearLayout>  

Java
Hurless answered 5/6, 2019 at 9:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.