Bug 52564 - When a button is set as the content of the ContentView, the button is not layout in FillAndExpand LayoutOption
Summary: When a button is set as the content of the ContentView, the button is not lay...
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.3.3
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jimmy [MSFT]
Depends on:
Reported: 2017-02-16 10:55 UTC by Suhasini
Modified: 2017-02-23 23:51 UTC (History)
3 users (show)

Tags: android, contentview, button, layoutoptions
Is this bug a regression?: ---
Last known good build:

Sample replicating the issue is attached (297.04 KB, application/x-zip-compressed)
2017-02-16 10:55 UTC, Suhasini
Screenshot replicating the issue is attached (28.14 KB, image/png)
2017-02-23 06:14 UTC, Suhasini
native android project (16.74 KB, application/x-zip-compressed)
2017-02-23 23:50 UTC, Jimmy [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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Suhasini 2017-02-16 10:55:16 UTC
Created attachment 19842 [details]
Sample replicating the issue is attached

When a button is set as the content of the ContentView, the button is not layout in FillAndExpand LayoutOption

You can replicate the issue in the sample attached.
Comment 1 Jimmy [MSFT] 2017-02-22 23:25:13 UTC
I ran the attached project (which is using Forms but I don't believe I was able to reproduce the issue. On all platforms the yellow button filled the entire page. And if I set the LayoutOptions to "Start", "Center", etc it would also work as expected.

What are you seeing when you run the attached project? Also, what platforms(s) you are experiencing this on?
Comment 2 Suhasini 2017-02-23 06:14:05 UTC
Created attachment 19919 [details]
Screenshot replicating the issue is attached

I provided the screenshot replicating the issue. In the screenshot you can see the yellow button having a Aqua border for the LayoutOption "FillAndExpanded". The background of the parent (aqua color is given as background to the parent) is in the view, replicating the issue that the button is not FillAndExpanded. I am able to reproduce this issue in Xamarin.Forms(Android).
Comment 3 Jimmy [MSFT] 2017-02-23 23:50:09 UTC
Created attachment 19937 [details]
native android project

The space around the Button is from the native Android Button's default background which has transparent pixels around the sides. I've attached a native Android project that shows this is the default behavior.

You can use a custom renderer to provide your own background drawable or color in order to eliminate the extra space[1].

[1] http://stackoverflow.com/questions/4682125/where-does-the-extra-space-around-my-button-come-from
Comment 4 Jimmy [MSFT] 2017-02-23 23:51:49 UTC
Marking as RESOLVED per info in comment 3