Frame ripple tap effect - xamarin

I am using xamarin forms, I using a frame that has TapGestureRecognizer, but when the frame is clicked there is no tap effect, how can i give a ripple tap effect to the frame like a button has?
Here a example, this look like a frame with a tap event, right?
Example:
https://im2.ezgif.com/tmp/ezgif-2-d9abfdafef.gif

You cannot do that with frames, its not there intended purpose.
What about using a normal button ? Then setting Your Theme to Material in your native Android project. You can learn how to do it here
android:theme="#android:style/Theme.Material.Light">
</application>
UPDATE:
You can get a sample on how to do it in forms here but you will not get that ripple effect your looking for

Related

Xamarin Forms buttons stop receiving mouse clicks after clicking on SkiaSharp CanvasView on iOS

I use SkiaSharp canvas to draw the main game screen, and then there are various Xamarin.Forms Buttons around the UI. This all works fine on when used directly on iPhone or iPad using a finger. However, when I connect a mouse (e.g., through a MacBook or otherwise), the buttons start working with about 10% chance after mouse-clicking on the SkiaSharp canvas (and not receiving the mouse click events with 90% chance). The SkiaSharp canvas itself works just fine.
If I bring up the iOS app launch menu from the bottom (which probably somehow temporarily exists the mouse navigation on the app), the buttons start working again with the mouse. But if I click the SkiaSharp canvas again with the mouse, the buttons have a high chance of becoming disabled again. If I change to using a finger, all works fine (even if the mouse clicks were not being registered immediately before). However, mouse clicks are not being registered even after touching with a finger, so finger-touching does not reset the issue with the mouse (but bringing up the menu from the bottom does).
We found this bug by testing the iOS game on MacBook Pro (the iOS apps recently came available on the App Store) but the same issue persists also directly with an iPad / mouse combination. It seems to be some sort of an issue between using a mouse (on iPad or on MacBook Pro), SkiaSharp canvas and Xamarin.Forms buttons.
Does anyone know what the root cause of the problem is and what is the workaround?
Not an answer as such, but some more information about reproducing the issue: A simpler repro case may be this small project: https://github.com/jrc14/TraceMatching/ .
Don't worry too much about what it's doing, but note that you're mean to click in the grey Skia canvas in the middle to create 'targets' - and that after you've done that, mouse-clicks are getting lost.
If you run it on a Mac, you'll see that, though the clicks get lost after you've clicked on the Skia canvas, they will start being received again if you click on something else (another app, or the Mac background).
(further edit) - after some noodling around I did find a workaround. If, once you've finished processing the touch action on the SKCanvasView, you reset its EnableTouchEvents property (i.e. set it to false, then back to true again), it seems that the clicks don't get lost any more,

Xamarin Forms - physical keyboard dims page when no input control is present

My actual application is using a bluetooth scanner in HID mode and capturing the input on the DispatchKeyEvent of the MainActivity. It works great except that the screens dims to some dark opaque color where it looks like everything is disabled and you have to navigate back to a page with an input control and tap on it to get the screen to go back to normal.
It's not as noticeable in the stock template but in my actual application (Screen shots at bottom) the dimming is very noticeable; it's a blue-gray opaque overlay that really stands out. I have no idea why it's like that. I'd almost just be happy if my actual app dimmed like the default forms sample.
Steps:
Make a Xamarin Forms app from one of the templates.
Change nothing.
Run simulator.
Press a button on your keyboard.
Result:
The screen dims and the soft keyboard does not popup.
Next Steps:
Add an Entry control. < Entry/> will do.
Click on it and the screen brightens back up.
Delete < Entry/>
Press a key on your keyboard and the soft keyboard pops up and the screen doesn't dim again.
What I want:
To know where the dim/overlay color/opacity is set so I can change it.
To not allow the soft keyboard to try and popup at all unless there's an entry field that has focus.
Here's screenshots from the default forms app:
Not Dim:
Dimmed after pressing the keyboard:
My actual test device is a Samsung Galaxy XCover Pro running Android 10.0. I'm working on porting a native Xamarin Android app to Forms so we can run it on iOS as well. I never had this issue with my android app and I'm not sure how to track down what's happening.
Here's a before pic. I've got an Entry field focused.
After scanning a barcode with my bluetooth scanner this happens:
There is NOT any overlay/modal boxview defined in the XAML. The overlay is nothing that I added. Though I seem to have done something to influence the color; I don't see anything in my styles.xml files that would change the color from the default light gray (as shown in the sample Xamrin Forms template).
I can reproduce this with a scanner on the "Welcome to Xamaring Forms!" as well, the screenshots don't really show the change in overlay color; its much more subtle; I really would like to know why in my app the overlay is so much more obvious.
I'm still annoyed it happens at all. But just in case anyone else using a
hardware keyboard as input (or a BT scanner connected as a HID) and you thought you'd be fancy and override one of the default styles and use a pretty green accent color like this: (though stupidOverlayColor has been changed to pink just to make sure I found the issue) - don't do it.
<!-- Base theme applied regardless of API level -->
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorControlHighlight">#color/stupidOverlayColor</item>
</style>
The moral of the story is that "colorControlHighlight" is evil and not to be overridden and used with hardware keyboards, unless you want your app to think the entire screen should get the highlight color after you scan a barcode like this:

Button press animation not working with border-radius

Version
2.0.2
Reproduction link
https://play.nativescript.org/?template=play-vue&id=3rSNIU
Platform and OS info
Android
Steps to reproduce
Create button
set css border-radius
What is expected?
worked press animation
What is actually happening?
not showing
That's expected, by applying border radius you modify the default behavior of Android.
You will have to either use plugins like card view / ripple in this case. There is a open feature request to improve support for ripple effects.

Xamarin Forms animation limitation?

In Xamarin Forms if you want to create animations quickly you can call any of the animation extension methods such as TranslateTo(x, y), etc according to:
https://developer.xamarin.com/guides/xamarin-forms/user-interface/animation/simple/
But they don't seem to cover everything. For example on the above link, I don't see:
A method to animate the background color?
A parameter to specify the easing factor?
What are the other animation limitations in Xamarin Forms API, compared to the full iOS and Android animation capabilities?
The "simple" ones are just the easy extension methods to do basic things. If you want the full control you need to use the animation class. There is even a background colour example a few pages below yours:
https://developer.xamarin.com/guides/xamarin-forms/user-interface/animation/custom/

Xamarin forms slider disable tap/click

I want to make a iphone like slide to unlock slider within xamarin forms.
So I want to disable the slider to be clicked on 100%.
I tried to add a tap gesture recognizer but unfortunatly this doesn't work/
Anyone with ideas?
Xamarin Forms can't work with anything more complicated than tap. You have to implement a custom renderer. There is an example which does what you want:
https://github.com/tkowalczyk/SimpleCustomGestureFrame

Resources