1 回答

TA貢獻1796條經驗 獲得超10個贊
實際上有兩個 PickerRendererXamarin.Forms.Platform.Android.AppCompat.PickerRenderer和基本Xamarin.Forms.Platform.Android的,基本的有這個問題你實際需要做的是這樣的:
namespace SolarmonAndroidApp.Droid
{
[assembly: ExportRenderer(typeof(CustomAndroidPicker), typeof(CustomPickerAndroid))]
public class CustomPickerAndroid : Xamarin.Forms.Platform.Android.AppCompat.PickerRenderer
{
public CustomPickerAndroid(Context context) : base(context)
{
}
protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Picker> e)
{
base.OnElementChanged(e);
if (Control != null)
{
Control.Background = Android.App.Application.Context.GetDrawable(Resource.Drawable.CustomAndroidEntryDraw);
Control.Gravity = GravityFlags.CenterHorizontal;
Control.SetPadding(5, 10, 5, 10);
}
}
}
- 1 回答
- 0 關注
- 134 瀏覽
添加回答
舉報