Bug 40169 - Unable to remove padding on Buttons
Summary: Unable to remove padding on Buttons
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.1.0
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-04-06 16:12 UTC by John Miller [MSFT]
Modified: 2018-03-30 00:32 UTC (History)
7 users (show)

Tags: ac
Is this bug a regression?: ---
Last known good build:

Sample Project (40.24 KB, application/zip)
2016-04-06 16:12 UTC, John Miller [MSFT]

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 40169 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description John Miller [MSFT] 2016-04-06 16:12:51 UTC
Created attachment 15630 [details]
Sample Project


   Even when using a custom renderer, it's not possible to remove the padding on the Forms buttons unless you modify the Android theme. 

**Steps to Reproduce:**

   Run the attached sample. 

**Actual Results:**

   The button renderer removes the padding, but it does not work:

**Expected Results:**

   The padding on the button should be 0 on all sides. 

**Build Date & Platform:**

   XF 2.1

**Additional Information:**

   The workaround is to modify the theme to set the minimum values:

<style name="MyMaterial" parent="android:Theme.Material.Light.DarkActionBar">
<item name="android:buttonStyle">@style/MyButton</item>
<style name="MyButton" parent="android:style/Widget.Material.Light.Button">
<item name="android:minWidth">0dp</item>
<item name="android:minHeight">0dp</item>

In a normal XA app, you can instead just use SetPadding, like the renderer, and it works as expected. It's unclear why SetPadding is not working for Forms using a renderer.
Comment 2 Marek Mierzwa 2018-03-07 10:41:54 UTC
Any update on this bug?
Comment 3 David Ortinau [MSFT] 2018-03-30 00:32:53 UTC
We have work in progress that should address this. https://github.com/xamarin/Xamarin.Forms/issues/1702