Xamarin Forms label animation at bottom of screen - xamarin

I'm essentially making a 'shopping cart' UI and I want it so that when the user hits the 'Add' button, a little tiny box-label appears at the bottom of the screen that says 'Added Item' or something like that.
My question is how to do that with my current set up. I am currently using a nested Grid inside of a Scroll view for the main content of the page. I want the box-label to fade in at the bottom of the screen and stay located at the bottom of the screen ontop of everything else even if you scroll, until the animation fades.
Now i figure it doesn't make sense to add it into the grid since the grid's end will be out of view in the scrolling part of the scroll view, and same for the Scroll View. I am considering nesting the entire scroll view inside of a stack layout but i fear the button will just be located at the end of the stack layout under the scroll view instead of on TOP of the scroll view. How do you recommend I achieve this effect?
I prefer not to use a custom renderer if possible due to my lack of experience in the three separate platforms.
Thanks

Make vertically oriented stack layout. When you need to add you animation add it programmatically to the stack. When it finishes remove it from stack. Your scroll view will not affect animation

Related

Swift 4 hide view and fill the blank

I want to make the search bar disappear by clicking the navigation bar item and make the collection view to fill the blank, animated obviously. ( like making the screen move upwards because the keyboard is showing )
is it Possible also to make it disappear when I scroll down an appear when I scroll up again ?
I dont think both ways will work at the same time but anyway I want to know how to make each way work.
thanks for the help :)
A collection view is a scroll view. A scroll view can have a delegate. A scroll view's delegate is told when the scroll view is scrolling. Therefore you can do anything you like in response to the user scrolling the scroll view, including moving the search bar.

How can I make the top and bottom elements of my view controller stay in place, while the middle has elements to vertically scroll through?

I'm working in Swift 3 and XCode 8.
I tried to find the answer to this question, but maybe I don't know how to ask it properly. I'm trying to have a title bar at the top of a view controller and have a back and next button at the bottom of the view. The content in between is longer than the space that exists, so I would like the user to be able to scroll the middle, but keep the top and bottom elements anchored in place.
I've tried to use a container with another view controller that is larger than the container to make this happen, but it just resizes the child view controller.
If I'm not explaining something properly, please let me know and I will try to give more information about what I've missed.
I'm making a few assumptions about your Views:
Navigation Bar for your title
Toolbar to hold your Back and Next buttons
Try the following:
Place a Navigation Bar as seen below. Do not set any constraints.
Place a Toolbar as seen below. Again, do not set any constraints.
Place a Scroll View in the centre of your View Controller and expand it so that the top and bottom are aligned with the navigation bar and toolbar respectively. Again, do not set any constraints.
Highlight all of the Views in the View Controller and place them in a Stack View.
Pin the Stack View to the Superview. These are the only constraints that are set in the example below.

Receive touch events after settings StackLayout.TranslateX property

I have a ContentView with a StackLayout with multiple children sized to the full width of the screen. In other words, if the screen width is 320 and I have five children, the inner StackLayout is resized to 1600.
In this ContentView, I have Next and Previous buttons that when clicked, animate the inner StackLayout's TranslateX property. Basically, I'm creating a carousel by translating the StackLayout within the ContentView. I chose this route because I was having layout issues using a ScrollView and a custom renderer when I would modify that layout of the view (by hiding labels, etc.)
However, I've hit a snag. Content that appears after I set the TranslateX property doesn't receive any tap events. I believe I might have to reset some tappable area, but I'm not even sure where to begin with that. Does anyone have any suggestions?
I posted this same question in Xamarin's Forums, and someone there answered. For anyone looking, the answer is here: https://forums.xamarin.com/discussion/comment/142914/#Comment_142914
If that link stops working at some point in the future for some reason, the relevant answer is:
Hit testing is done based on the actual frame of the control determined by layout, but translation happens after layout. Therefore hit testing does not take translation into account. If you want a view to be touchable then you should update its layout directly rather than using translation.

Can't get the most basic scrollview to work

This is not my day. I've just deleted every object from my previously completed view controller to start over because I can't get a simple scroll view to scroll. I've got a view controller that is embedded in a navigation controller. I put scroll view inside the view controller and then put two text fields inside the scroll view, one field at the top and one at the bottom.
First of all, when I run this, it won't scroll. What is the point of the scroll view if it won't scroll?
Second, I can't figure out how the relationship between the navigation bar and the scroll view works. Is the scroll view behind the navigation bar? Is it below the navigation bar? In the story board, it looks like it is behind the bar, but when I run it, my text field is pushed down so far that it looks like it is behind it.
Here are a couple of screen shots. To say that I am frustrated is an understatement. Thanks for any help getting me out of my circular problem. I appreciate it.
And here is how it looks when I run it. Notice how far down the top text field gets drawn. Also note that you cannot see the bottom text field. I am unable to scroll to this. What gives?
First of all, when I run this, it won't scroll. What is the point of the scroll view if it won't scroll?
Scroll views won't scroll by default unless their contentSize exceeds their bounds. You can force it to scroll anyway by setting alwaysBounceVertical to YES.
Second, I can't figure out how the relationship between the navigation bar and the scroll view works. Is the scroll view behind the navigation bar? Is it below the navigation bar? In the story board, it looks like it is behind the bar, but when I run it, my text field is pushed down so far that it looks like it is behind it.
Yes, in iOS 7, by default, a scroll view will start at y = 0, behind the nav bar. You use the contentInsets property to push it down. The view controller has an automaticallyAdjustsScrollViewInsets property that can handle this for you.

dojo Show/Hide One ContentPane While Another ContentPane Is Liquid

I've been struggling for weeks trying to crack this nut so I'm not sure if it's impossible, or if it's my lack of coding chops... or both. I'm not a programmer and I'm a newbie to Dojo Toolkit.
I have a site using the BorderContainer layout. I'm trying to create an effect where I can use a button to open and close a dropdown type box that will contain controls. I need this dropdown to be hidden on page load, and then open when you click the button.
My problem is that when I open the dropdown, it pushes the content pane below it off the bottom of the browser window. I need the lower ContentPane to stay fit within the remaining space of the browser window when the dropdown opens. Additionally, I want the dropdown to sit outside of the scrollable container for the content below it, which is why I have it set up to sit outside a nested BorderContainer below it.
I've created a simplified version of the code to demonstrate my challenge (see link below). If you load the page you can see the center ContentPane scrolls the content. But, if you then click on the button, a dropdown div expands above the content. Then when you scroll, you'll notice that you can't see the full pane because it's in no-man's-land below the bottom of the browser window. I assume that because the div is set to display:none on load, it's size is not accounted for on page load. Then, when you open it by pressing the button, it's size is additive and the pane below doesn't know how to resize or account for the new element.
I've tried using the visibility attribute, but that leaves a gap for the div when it's still closed. I've tinkered with some code that controls the height that shows promise, but each of my dropdown boxes will be different sizes so I'd prefer that the height be set to "auto" rather than a specified pixel size.
Does anyone have any idea how I can accomplish this so that the lower pane will fit in the space without pushing off the screen?
Here's a sample of the page:
http://equium.com/scaffold.html
(I had some problems trying to insert the full HTML page here as a code sample so if that's a preferable way to handle it, and someone can let me know the best way to embed all of that code, I'd appreciate it.)
Thanks is advance, I'd really apprecaite anyone's feedback.
You might want to take a look at dojox.layout.ExpandoPane (though be warned I think it has only worked properly for top and left regions for a while).
Also, I'd suggest simplifying/altering your layout a bit. See example here:
http://jsfiddle.net/taFzv/
(It'd probably need some tweaking to get exactly what you want.)
The real issue you're having is probably that the BorderContainer has no idea that parts of the view resized. ExpandoPane takes care of that by telling the BorderContainer to re-layout after its animation completes.
It works under IE8.0. When dropdown box open, just keep pressing mouse from page and drag to bottom, you could see the content was pushed to out of page. It looks the browser could not detect it and could not add it to "scroll bar" account.
I would suggest taking out all BorderContainers except your top level one, the one with mainPage as the id.
Place your {stuff here} div into the mainPage BorderContainer, after the ContentPane with the Close/Open button. Make sure you make it dojotype dijit.layout.ContentPane, set up layoutpriority, and set region to top. Set the height to 0/x when clicking the Open/Close button, instead of setting display.
Try your page again. If that doesn't fix it, you probably need, a call to layout, resize, or both to indicate to the BorderContainer that it needs to evaluate all its children and size the "center" pane properly. Something like dijit.byId("mainPage").layout(); Do this any time someone presses the Close/Open button, after you have changed the height of any BorderContainer children.
Maybe the dijit.form.DropDownButton would fit your needs. When click the button a tooltip is displayed that can be filled with any content you want. Just as you specified, the dropdown tooltip is only displayed when you click the button, and it doesn't mess with the underlying layout at all. The tooltip sits "on top" of the page.

Resources