how to do a horizontal carousel layout in nativescript? - nativescript

As the picture above demonstrates, I want a layout that could contain A,B,C 3 sections. But only section B would be visible, A & C should be hidden, but when user swipe on section B, they could see the content of section A or C. I know ScrollView could do this, but I don't want it to be scrollable to the user. I want to programmatically control the behaviour when user swipes on it. Similar to the carousel. I have tried normal layout like GridLayout, FlexboxLayout...they all will contain the elements in the page, they just didnt let them overflow. So anyone has any idea on how to work around on it, please let me know, thanks.

I would recommend using nativescript-carousel (https://market.nativescript.org/plugins/nativescript-carousel) to achieve this. I think that is pretty much what you are after - just hide the indicator (dots). There are demos on that page for how to use with vanilla javascript, angular, or vue.
It makes use of DKCarouselView for iOS and ViewPager for Android.
You can also hook onto the slide tap and change events easily enough, which is all in the demo usage instructions.

Related

Flutter how to add a button in a list view that persists after scrolling to a certain point..

How would I create the shuffle play button shown here: https://media.giphy.com/media/25a17rL4Wm89idzPib/giphy.gif in flutter? Is there a specific widget or library I could utilize? Anything helps thanks!
You could use a NestedScrollView with a SliverPersistentHeader as one of the widgets inside the array of headerSliverBuilder, to achieve the effect of persisting the header after you scroll up.
You can refer to this tutorial for the same

Unified NSToolBar/Titlebar with icons and labels?

Our designer wants a unified toolbar/titlebar (such as what Safari, XCode, et. al use) but wants labels under the icons. I have the display mode on my NSToolbar set to IconAndLabel but I still only get icons... if I do separate title and toolbars the labels show up.
I've found nothing in the docu or even via googling that suggests you're forced into icon-only view but that seems to be the case. What's the best way to get labels on these buttons? I want to avoid putting the labels in my image assets as that will complicate localization, so if that's the only choice I'd have to do it programmatically using a localized string.
As far as I know there is no way of having both the new unified toolbar and labels. Maybe you could put a bar under the toolbar that contains the labels, aligned perfectly to the images.
But do you really need the labels? Apple is trying get rid of them with the new toolbar design. Try to make your icons as self-explanatory as possible. Don't forget that there are tool tips available as well for the button titles..

Scrollable when keyboard displayed?

I have a registration form on my layout grid, made out of a stackPanel. Textboxes are taking most of the screen (800px) along with a button. When user is positioned in one of the text boxes, keyboard covers almost half the screen and in order to access boxes below, they first have to click somewhere blank to remove the keyboard and then click another box. It isn't possible to scroll down.
I want to enable same behaviour like when editing name in contacts, but didn't manage yet. How to achieve this?
Try wrapping it into a ListBox or a ScrollViewer (probably easier), like so:
<ScrollViewer>
...
</ScrollViewer>
Also, check to make sure you don't have the same problem described here.
I'm not a WP7 developer but here's what I do in Android and iOS and you may get a hint of what to do.
I wrap my forms in a Scrollable View. This gives easy scrollable features to users without the need of anything else.

What's wrong with my jQuery plugin? (Won't animate)

I'm building my first jQuery plugins. One is a tab-views switcher thing, and the other is a sliding pager thing. They can both be seen on this test page: http://test.benlwilliams.com/powerwash/
The problem I'm having is with the slider plugin called, blwslider(). The implementation can be found at the bottom of the test page.
I want to be able to have any number of sliders to be independent of one another. The slider on the top works perfectly, but the slider on the bottom will not animate the sliding.
The bottom slider has 2 pages, and starts on the first page. You can see by clicking on the arrows that they appear and disappear correctly, as if the page had turned, but no animation is actually happening to turn the page. What makes me really confused is that if I use Firebug and put some "stops" in the turnPage function, all the variables have the correct values. I can't find any reason why the page is not turning.
I also considered that maybe only the first appearance of a .blwslider() is working for some reason. But I already swapped the order of the two chuncks of slider code, and still the slider with the #slider2 chunck refuses to work.
All the code is visible with firebug, but let me know if I need to post something specific. Thanks!
So it turns out it has nothing to do with the plugin's implementation or structure, but rather a math problem when the slider has only two pages.

Which is better, some grids collapsed or some user controls?

I'm developing a Windows Phone 7 application that uses some Transient content.
To avoid to go back to that transient content I've decided to use a phew page with several grids on the same page.
When I have to show another "page" I set to collapsed current grid and then I set to visible desired grid.
I know this can be done using user control, but I'm not sure if using user controls can be slowest that using Grids. Any advice?
And another question is if I use grids, how can I use page transitions?
Another option for when you want to show transient content is to use a Popup control. This won't appear in the navigation stack, so when a user goes back (<-) they won't see this content.
However, Popup content isnt GPU accelerated, so you only want to display simple content, no animations etc...
If you want page transitions etc... then i think your only option is to use Pages. That way you can do the transitions and the back button works as expected.
It doesn't matter if you do this via user controls or grids - what matters speed wise is the complexity of your layout.
A user control may be better if you are doing this on a number of pages so you don't repeat yourself.
One way to do page transitions is to do it with stack panels. Have the second "hidden" stack panel way off to the right so it is off screen then animate it in.

Resources