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. Image for the cookie policy date

How to create custom renderer for SfButton on Android?

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

2 Replies

RK Radoslaw Kubas 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




LA Lavanya Anaimuthu Syncfusion Team 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. 


Loader.
Live Chat Icon For mobile
Up arrow icon