What do you think is the best way to implement the following: there are two views (A and B) and both should have the same height of the screen. View A should be on top of View B. View B is accessed by scrolling down on the screen (like a list view).
Would you use a vertical ViewPager, ListView, ScrollView, other?
Thank you
If you want to be able to stop showing half of both views use scrollview. If you want to switch between whole views use vertical pager. It really depends on what effect you want to achieve.
Related
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
I want to develop an app that includes GridView and I want it to be some thing like horizontal ListView above a gridvew .Horizontal view displays images downloaded from url.I saw this touturial ( horizontal scrollview used)
and saw this to put the GridView inside scrollView because i want to put the gridview(episode #2) and horizontal view (episode #1) in vertical scrollview(episode #3) . I need to scroll the horizontal view vertically when a user is scrolling the gridview and not to have fixed position at the top of the screen.
I have no idea how to do this (use horizontal ScrollView or horizontal Listview)?
after vertical scrolling I want it to be like this (horizontal view must get scrolled vertically):
This is a custom interaction, so you probably will not be able to use a "standard" tool for this. You may want something like the FloatingActionButton (an example here: http://antonioleiva.com/collapsing-toolbar-layout/) but you also want it to scroll, so you may need to extend that class.
Also, you could use touch events to do a custom animation on the area, because you will need to track when it is displayed and the direction/distance of the motion event to collapse/expand it. You also would need to know anchors on the list, to determine when it should reappear...
This is a cool design concept, but usually "cool" = "difficult" because it's not standard.
I'm trying to have a horizontal scroll view contain, for example, three vertical scroll views. And what I want is to be able to have the horizontal scroll view align to each vertical scroll view when you scroll over to it.
I'm not sure if a horizontal scroll view is the correct way to implement this kind of feature, however I found the method scrollTo(x,y) which I think may be in the right direction to creating this.
The best example of what I'm trying to do is shopping for music in the google play store (atleast, on my nexus 7). It allows you to scroll left or right, and it aligns to a screen's worth of content, which you can then vertically scroll.
So, that's what I'm trying to recreate in my app. But I'm confused on implementation details of allowing the horizontal scroll view, to scroll, and stop at a certain point. It looks like I need to override HorizontalScrollView to capture the motion events, but I feel like that's too complex for what seems like a simple task.
Does my question make sense? I basically am at the very starting point of creating this, and need some help as to where to go next.
I'm developing an app that has an UI pretty similar to Play Store. It is organized as a multiple panels one above another. First it has a panel containing a photo. Under that it has another panel containing some text and a custom background color. Under that it has another photo and finally it has a Linear Layout with vertical orientation containing a pretty long list of little views filled dynamically at runtime. I have all this inside a Scroll View, naturally.
The problem? That dynamic fill of the linear layout takes a long processor time and makes my app unresponsive during those inner views inflation. So I thought to replace the linear layout by a Recycler View. And the performance is awesome!
So? Well... Not everything is so awesome. I can't scroll the Recycler View because it's inside the Scroll View. And if I remove the Scroll View then I can't scroll the entire view (some things doesn't fit on the screen).
What's the best approach for fixing this?
It's not recommended to use a RecyclerView or ListView inside of a ScrollView precisely due to the double scrolling issues. RecyclerView is very robust and is prepared to receive headers, footers, etc. I see no reason why the entire layout could not be inside of a RecyclerView instead of a ScrollView
The ViewHolder implementation can include logic to inflate different layouts depending on what section should be next.
Pseudocode:
i.e.
if(currentAdapterItem == sectionA){
useLayoutA();
} else{
useLayoutB();
}
Just use a NestedScrollView instead of a normal ScrollView. It handles the nested scrolling quite well.
I have to display multiple custom view with scrollable behaviour (as a grid list).
Like scrolling horizontally and vertically on a chest grid where each item is a custom view.
What is the best way to do this on android ?
ps: I have seen we can use ScrollView -> TableLayout -> row -> list of custom view
sources:
http://androiddevblog.blogspot.com/2009/12/creating-two-dimensions-scroll-view.html
http://sdroid.blogspot.com/2011/01/fixed-header-in-tablelayout.html
Android TableLayout does not scroll vertically
How to make a scrollable TableLayout?
Thanks ;)
I would look at this example.
http://developer.android.com/training/implementing-navigation/lateral.html
Look at the section labeled "Implement Horizontal Paging (Swipe Views)"
A view pager will allow you to swipe to the right and left, while having a custom view that can scroll up and down.
Even if this exact example doesn't work for you, you could probably look at the source code for view pager. All its doing is caching x number of custom views and listening for touch events to show the next view.