How do I scroll a Gridview in Android, so icons will appear? - android

I want to scroll the screen vertically in a grid view. As I scroll downwards, icons should appear.
I implemented it in a view flipper which was quite easy. I searched in Google, but couldn't find much help.

If you use android:smoothScrollbar="true" for your Gridview in the layout file, then it becomes scrollable automatically, if the number of grid items exceed the screen size.

Related

how to move all the Layouts up when scrolling more in the list view in android

i have a fragment which has a stationary Image View at the top , some linear layouts to display the texts and List View at the Bottom. i want the entire screen to go up(that stationary Image View and middle part) when i scroll down in the List View.
I tried to place all layouts in a single Linear Layout and put it inside Scroll View since it has only one direct child..but that makes only the List view scroll able.
Try using CoordinatorLayout and scrolling behaviour from the design library.You can find a great tutorial here

Show Row Per Row While Scrolling Listview -- Android

I have a listview with rows as big as the device screen and I want to show row per row while sliding, I don't want to show parts of rows when doing so, is there any way of doing it.
ListViews are not made for this kind of use case. ViewPagers are, but they scroll horizontally. It's possible to make it scroll vertically (see Android: Vertical ViewPager), which should be what you're looking for.
The problem with adjusting the size of each ListView item to fill the screen is that match_parent simply doesn't work. You would need to calculate the exact size you need (screen height minus action bar and other views that are not part of the ListView). It's probably possible, but not worth the trouble.

How to create a gridview with spacing at the top

I was looking to create a GridView that stretches across the entire screen. However, when the user first opens the screen, the top of the first item should be about halfway up the screen.
For example lets say we have a GridView of 12 items displayed 3 x 4. When the user first opens the screen, only the first six items would be seen with a large margin at the top of the screen. The user can then scroll the list to see the other items. The top items would eventually reach all the way to the top of the screen.
If I was using a ListView, this is simple. I merely create a 0dp headerView with a large top margin. But, GridViews do not allow for headers. What is the best way to handle this situation?
Normally, you DO NOT make a GridView inside a ScrollView. It's not recommended! But sometimes you have no choice and you need to addHeaderView() on a GridView (But I repeat, it isnt recommended).
So, to make this happen, you have to make a custom GridView. This answer will be usefull in your case: Grid of images inside ScrollView
I had a same situation and I used this one: HFGridView by #SergeyBurish! Very simple and really great. (See the last answer here: A GridView with header and footer).
Hope this will be helpful.

android.widget.Gallery inside a ViewPager?

I need to place a android.widget.Gallery inside a view pager at the bottom. The user will read and scroll all the way to the bottom and than see more pictures to view inside the Gallery at the bottom. I want to be able to scroll horizontally through the Gallery w/o switching pages. So when the user is interacting with the Gallery, I don't want the horizontal swipe of the ViewPager to take over and switch pages. How can this be done?
I don't recommend horizontal scrolling item in a horizontal scrolling viewpager.
To try this you have a couple options, lots of items: 1.) search horizontal list view. less items: 2.) horizontal scrollview. I guess option 3.) use gallery even though depreciated.
However, I encourage you to try it, it just doesn't work very well with two items scrolling the same way.
For the same reason it's not a good idea to have a vertical scroll inside another vertical scroll.
About the only way this can work is if you give the user a separate full screen non-horizontally scrolling window with your horizontally scrolling item.

HorizontalScrollView shrinks GridView to small line

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.

Categories

Resources