We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to create custom renderer for SfButton on Android?

Thread ID:

Created:

Updated:

Platform:

Replies:

151198 Feb 3,2020 02:20 PM UTC Feb 7,2020 03:46 AM UTC Xamarin.Forms 2
loading
Tags: SfButton
Radoslaw Kubas
Asked On February 3, 2020 02:20 PM UTC

Hello,

I need to  create custom renderer on Android and iOS for SfButton. Can you give me the name of the class I need to inherit from on Android?

On iOs I used Syncfusion.XForms.iOS.Buttons.SfButtonRenderer but can't find equivalent on Android.

Best regards,
Radek

Radoslaw Kubas
Replied On February 3, 2020 03:37 PM UTC

Hello again, I have one update to the question.

After some tests I noticed that Syncfusion.XForms.Android.Border.SfBorderRenderer do the job, is it correct?

And with it I noticed another problem, I just wanted to override OnElementChange

protected override void OnElementChanged(ElementChangedEventArgs<View> e)
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                Control.Touch += Control_Touch;
            }
        }

but it seems that Control is null. How can I subscribe this event other way? Or I just need execute something like this in platform code soo there way will be perfect to:

private void Control_Touch(object sender, TouchEventArgs e)
        {
            if (e.Event.Action == MotionEventActions.Down)
            {
                Control.PerformHapticFeedback(FeedbackConstants.KeyboardTap);
                Control.PlaySoundEffect(SoundEffects.Click);
            }

            e.Handled = false;
        }

Thank you in advance for your help.

Regards,
Radek



Lavanya Anaimuthu [Syncfusion]
Replied On February 7, 2020 03:46 AM UTC

Hi Radoslaw Kubas, 
 
Greetings from Syncfusion. 
 
We have validated your query and would like to let you know that, currently we did not set the native control in our implementation.  
 
Limitation:  We failed to get the native control on custom renderer since control implementation from Syncfusion Border, all other customization happens through drawing. Currently we are checking other possible ways to achieve the same and we will update the status of Android on February 11,2020.   
 
We appreciate your patience until then. 
 
Thanks, 
Lavanya A. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon