Merge branch '3.2.0' into 3.3.0
This commit is contained in:
Коммит
2268657174
|
@ -59,8 +59,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
if (colorToSet == Color.Default)
|
||||
colorToSet = Element.BackgroundColor;
|
||||
|
||||
if (_backgroundDrawable == null)
|
||||
_backgroundDrawable = new GradientDrawable();
|
||||
if (_backgroundDrawable != null) {
|
||||
|
||||
if (colorToSet != Color.Default)
|
||||
_backgroundDrawable.SetColor(colorToSet.ToAndroid());
|
||||
|
@ -69,6 +68,12 @@ namespace Xamarin.Forms.Platform.Android
|
|||
|
||||
this.SetBackground(_backgroundDrawable);
|
||||
}
|
||||
else {
|
||||
if (colorToSet == Color.Default)
|
||||
colorToSet = Element.BackgroundColor;
|
||||
SetBackgroundColor(colorToSet.ToAndroid(Color.Transparent));
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
|
@ -101,11 +106,14 @@ namespace Xamarin.Forms.Platform.Android
|
|||
void UpdateCornerRadius()
|
||||
{
|
||||
var cornerRadius = Element.CornerRadius;
|
||||
|
||||
if (Background is GradientDrawable backgroundGradient)
|
||||
{
|
||||
var cornerRadii = new[]
|
||||
{
|
||||
if (cornerRadius == new CornerRadius(0d)) {
|
||||
_backgroundDrawable?.Dispose();
|
||||
_backgroundDrawable = null;
|
||||
}
|
||||
else {
|
||||
this.SetBackground(_backgroundDrawable = new GradientDrawable());
|
||||
if (Background is GradientDrawable backgroundGradient) {
|
||||
var cornerRadii = new[] {
|
||||
(float)(cornerRadius.TopLeft),
|
||||
(float)(cornerRadius.TopLeft),
|
||||
|
||||
|
@ -122,5 +130,8 @@ namespace Xamarin.Forms.Platform.Android
|
|||
backgroundGradient.SetCornerRadii(cornerRadii);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateBackgroundColor();
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче