I have a TabLayout inside a CoordinatorLayout set up using ViewPager.
In the first fragment I have a GridView inside a SwipeRefreshLayout. I have set the nested scrolling on for GridView using gridView.setNestedScrollingEnabled(true);
It works fine for API level 21 and above. Now for API level 19 i expect the app bar to not collapse but at least the GridView should be scrollable till the end row.
Instead what's happening is the bottom most row is not fully display, i.e. can't scroll till the bottom of gridview. And the height that's cut off(not scrollable) at the bottom row is visually the same height as that of the app bar.
My understanding is, if the nested view cannot be scrolled then it should just take the remaining height i.e. fill_parent, although even setting that to gridview doesn't help.
I've tried all possible permutations of setting layout heights but couldn't get it working. Could someone please guide me further?
Related
I am working on a feature for one of the project, where i have a image in the ListView header, And the content bottom to the Header. When i force scroll the ListView, though there is not space to scroll, i need to increase the height of the header so that it displays the bottom part of the image in the header view, when i release the scroll, the scroll should go to the actual height where it is earlier. Can you please help me on this on how to do, i am trying multiple approaches but not getting the expected behavior.
I have a layout with a linearLayout (top layout) and a listview under this.
What I want to do is like the phone app in Lollipop:
With the scrollbar I can scroll the contact list (top layout doesn't move)
When scroll the list with the finger, first the top layout is scrolling and once it is not visible anymore the listview scroll. When the top layout is visible the scrollbar doesn't move.
Someone has any idea how to do this trick?
What I'm thinking :
I can add the top layout to the header of listview, but the scrollbar take count of the header. And if I scroll with the scrollbar, the top layout will scroll
Trying to set a scrollListener to the listview, and translate the top view, but don't think it will be good and the scrollY is not available for listView
I think I can do something with a scrollView for the root layout, but I know it is not good to put a listview inside a scrollview.
I don't find any proper way to do this kind of feature...
EDIT: To be more clear, I want to translate the listview before I'm able to scroll the listview itself. Problem is when translate listview, the listview height will not expand.
I am also getting this problem in version 5.1 in lower version it's working fine.Try to use in 5.0 As it STABLE verson, also check another scrolling bug in 5.1 in this link here I could not comment so posting this as answer.
ListView content being added at bottom instead of top
I'm using ListView to display a list of data elements. Previously the height was set to wrap_content and it was working fine but with few performance lags. Then I came across a blog saying ListView's height should not be set to wrap_content for good performance. After doing this, i.e. setting height to fill_parent, all of my data rows started appearing at bottom of the ListView instead of top. Can any body point to what possibly I'm missing. Thanks in advance.
add this attrubut to your list view android:stackFromBottom="false"
In my app I have a scroll view with n number of data to be listed out. There are two buttons one is named as UP placed above scroll view and the other is DOWN placed below scroll view.
Using the UP and DOWN buttons the list of views can be scrolled.
When the scroll bar is in top the Up button will be invisible and when the scroll bar reaches the bottom the DOWN button will become invisible, I have written logic for this using the getScrollX() method.
Now my problem is when there is very few data for example 3, the scroll bar will not be visible and the layout cannot be scrolled, in such a case both the UP and DOWN buttons need to be in invisible. How to do this, please suggest me a way?
You can try and use a ViewTreeObserver to check the dimension of the View inside your ScrollView. If the dimension exceeds a certain limit (such as the screen size), the ScrollView will be scrollable. See this preview SO answer for more details. Hope that helps!
When I put a HorizontalScrollView around a GridView, the GridView gets compressed into a small column on the left. The Gridview's vertical scrollbar even appears on the left. The HorizontalScrollView's width is set to fill_parent and the GridView is also fill_parent. I don't know why this is happening.
I tried setting the GridView's visibility to GONE and VISIBILE like someone recommended but it doesn't do anything. However if fastScroll is enabled on the GridView, then dragging the fast scroll tab vertically causes the GridView to expand horizontally and it keeps expanding past the last column.
I understand now why this cannot be done. There should be a way to force the GridView to load all horizontal items and allow horizontal scrolling.
The better choice would be for them to implement some kind of DataGrid control. Most people are under the impression that GridView like a DataGrid.