xamarin/Xamarin.Forms

[Android] Image on Button is not centered with text

Aperta

#3527 aperta il 9 ago 2018

 (15 commenti) (4 reazioni) (0 assegnatari)C# (1926 fork)batch import
a/buttone/3 :clock3:help wantedinactivep/Androidt/bug :bug:up-for-grabs

Metriche repository

Star
 (5644 stelle)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

Description

The Image is not in the center on Button when displaying with a text.

Steps to Reproduce

  1. Create a Button with an image & text.
  2. Set thee HorizontalOption to Fill&Expand.
  3. You can see that the image is stick to the left border
  4. If you change the position(Top,Right...) of the image it will stick on the position selected, not centered with the text

Expected Behavior

The image have to stick the text on the center.

Actual Behavior

The Image is stick to the border depends of the selected position. I was searching a way to make a correction on UpdateBitmap But PropertyName "Image" never pass to UpdateBitmap

        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == Button.TextProperty.PropertyName)
                UpdateBitmap();

            base.OnElementPropertyChanged(sender, e);
        }

Basic Information

  • Xamarin.Forms: 3.1.0.697729
    • Android: 8.1

Guida contributor