【发布时间】:2021-02-22 17:23:47
【问题描述】:
我需要更改进度条的高度,但只是针对特定的 ContentPage,而不是针对我所有的 ContentPage。我得到了更改进度条高度的代码:
public class CustomProgressBarRenderer : ProgressBarRenderer
{
protected override void OnElementChanged(
ElementChangedEventArgs<Xamarin.Forms.ProgressBar> e)
{
base.OnElementChanged(e);
Control.ProgressTintColor = Color.FromRgb(0, 0, 0).ToUIColor();// This changes the color of the progress
}
public override void LayoutSubviews()
{
base.LayoutSubviews();
var X = 1.0f;
var Y = 10.0f; // This changes the height
CGAffineTransform transform = CGAffineTransform.MakeScale(X, Y);
Control.Transform = transform;
}
}
我想知道这是否真的可能。提前致谢。
【问题讨论】:
标签: c# xamarin xamarin.forms xamarin.android xamarin.ios