1

I had an app perfectly working with support library version 23.1.1, where a RecyclerView shows a Loading View during data fetch using a LinearLayoutManager and a RecyclerViewerAdapter.

------------------ Chapter One - Everything Works ----------------

Showing Indicator in the middle. The Layout covers the whole view.

enter image description here

Gradle File Shows it is using 23.1.1 version of Support Libraries.

gradle 1

If you look at line 21, I get the height of parent view from Layout Manager and set it to the loading view.

Code

------------------ Chapter Two - Everything goes South ----------------

I updated the Support Library

enter image description here

Nothing shows up

enter image description here

It turned out the parent.getMeasuredHeight() returns 0.

------------------ Chapter Three - Some Hints ----------------

From one of the answer from a StackOverFlow question, I thought WRAP_CONTENT or MATCH PARENT will work instead of parent.getMeasuredHeight(). But, it did not help either.

Result of WRAP_CONTENT

enter image description here

GitHub Link

Community
  • 1
  • 1
Bavan
  • 1,021
  • 1
  • 10
  • 24
  • Just put your `Recycleview` in some `Framelayout` add one imageview or something(your progress bar) in that. Make that view visible during the loading and make it invisible or gone when you need to fill data in `RecycleView`. **Why to complicate things by filling `RecylceView` with a single item you already have complications when you are using `RecycleView` as a newbie** – Janki Gadhiya Jul 04 '16 at 07:05
  • Here is the thread about setting `RecyclerView` height to wrap content: http://stackoverflow.com/questions/27475178/how-do-i-make-wrap-content-work-on-a-recyclerview – R. Zagórski Jul 04 '16 at 07:11
  • I agree with Janki. But, It will be a huge change in the code base which someone else wrote and claimed it completed. Anyway I have written a method which traces a view, with height greater than zero, up from the view group we have and use that height to set the height of our layout. It seems to work for now. – Bavan Jul 04 '16 at 07:34

0 Answers0