I want to display a large list of items in horizontal direction. I found GridView which uses UICollectionView (for iOS) or RecyclerView (for android) which is working properly in vertical direction. But I cannot find a way to make it horizontal.
I was wonder is there a way to use this component in horizontal direction or is there another component for this purpose?
PS: I don't want to use a normal ScrollView because it does not use lazy loading for items and for large lists, it will destroy performance of the app.
Thanks
You may use RadListView here and set the scrollDirection to Horizontal on the item layout.
npm i --save nativescript-ui-listview
Related
I'd like use BoxView to present timelines, and each color of the lines represents a kind of task.
I have used Grid to do this. However, you know, minute is a small unit so that there are hundreds of rows in one page. That leads to a performance problem.
With Xamarin.Android, I can use Linearlayout, set height "0dp" and set weight attribute a suitable value to do this.
Well, can StackLayout do so? If not, which other layout should I use.
effect drawing
I'm trying to do this animation in flutter :
https://material.io/guidelines/motion/choreography.html#choreography-creation
My problem is that I have absolutely no idea how to do that.
As far as I know, widgets in flutter don't know their position nor the position or other widgets at all.
And you can't access context.size inside the build method.
I tried to use Hero animation to do it. Or ScaleTransition. But it's definitely not working.
You can use showMenu to dynamically show a popup menu at a given location. Consider using PopupMenuButton, which is an IconButton that automatically shows a menu when it is tapped. There's an example in the Gallery. If showMenu doesn't do what you want, you can copy the code in popup_menu.dart and customize it to make your own version. It uses CustomSingleChildLayout and PopupRoute.
If you just want to absolutely position a Material or Card on top of other elements, you can give it some elevation and use a Positioned within a Stack. You can use an AnimatedSize to adjust the element's size with a Curve. This won't interact with the back button on Android automatically, so if you want that, you may have to use addLocalHistoryEntry or PopupRoute.
If I understand you correct - you want to show square widget, and animation is not suitable at most because widget doesn't know its size.
In this case you can try MediaQuery.of(context).size.width - it returns width of your screen, so you can use it for calculating widgets size
I've got a question about Xamarin Android GridLayout:
How can I make spacing between the cells in a GridLayout?
Thank you very much!
Are you using custom Views for each cell or are you creating all the cells in the layout file?
If you are creating all the cells in the layout file like in this example,
you can use the android:padding attribute on each cell to add the amount of space you want to each element. If you are adapting custom views to the GridLayout, you can use attributes in the layout you are inflating like padding or layout_margin.
You can use android:verticalSpacing and android:horizontalSpacing in your GridView to make spacing between the items. Check this answer here, it might help you:
Increase the grid spacing in android
Hope this solves your problem. Cheers!
How can I create simple image carousel. Let's say I have GridView with two rows and one column. I want to create image carousel in upper row. Can I do that with ScrollView. Any sugestions?
You have the right idea. You can use gridLayout just to keep your sizing in line, and using scrollView is perfectly fine.
I do not know exactly how you imagine such a carousel working, but one option to be aware of in scrollview is the 'paginated' option. This allows you to easily define target positions for scrollview to stop and snap to, similar to a scroll picker on native. Or if you want the sources definition..
* #param {Boolean} [paginated=false] A paginated scrollview will scroll through items discretely
* rather than continously.
The next thing you may want to think about is how a carousel goes round and round and never reaches an end like scrollview would. There is no option for this by default, but I found a way it can easily be done. It may be a bit trickier with smaller images, but here is an example I did for a infinite panorama.
Transforming Panoramas for Virtual Tours with famo.us, has it been done?
The trick was to use a second duplicate image trailing the scrollview and when scrollview was in the right position, we could jump it back to the beginning, with no visual evidence to the user.
Here is the live example..
http://higherorderhuman.com/examples/infinite.html
Hope this helps you get started!
what i'm trying to do is displaying a set of images in a grid like fashion but with different sizes as for images in landscape or portrait position, this excludes using the NSCollectionView because the item prototype's size can only be set once...
i'd go and add subviews programmatically to a scrollView but this yet again when the window's size changes and the scrollView get a bigger width, there will be just blank spaces on the right side...
you can checkout the image below for a better understanding...
http://i.stack.imgur.com/NVJjP.png
thanks in advance you guys...
what i ended up doing was implementing a purely mathematic algorithm where i calculated the (x,y) position for every new added photo depending on the previously added photos and it did a pretty good job... the container holding the photos was embedded in a scrollView, needless to say that i had to calculate the height of this container as well.