padding/margins for entry/picker

This commit is contained in:
Kyle Spearrin 2019-05-07 23:22:25 -04:00
parent cf2ae9d7e8
commit 5dc4357078
3 changed files with 56 additions and 1 deletions

View file

@ -0,0 +1,25 @@
using Android.Content;
using Bit.Droid.Renderers.BoxedView;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
[assembly: ExportRenderer(typeof(Entry), typeof(CustomEntryBarRenderer))]
namespace Bit.Droid.Renderers.BoxedView
{
public class CustomEntryBarRenderer : EntryRenderer
{
public CustomEntryBarRenderer(Context context)
: base(context)
{ }
protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
{
base.OnElementChanged(e);
if(Control != null && e.NewElement != null)
{
Control.SetPadding(Control.PaddingLeft, Control.PaddingTop - 10, Control.PaddingRight,
Control.PaddingBottom + 20);
}
}
}
}

View file

@ -0,0 +1,25 @@
using Android.Content;
using Bit.Droid.Renderers.BoxedView;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
[assembly: ExportRenderer(typeof(Picker), typeof(CustomPickerBarRenderer))]
namespace Bit.Droid.Renderers.BoxedView
{
public class CustomPickerBarRenderer : PickerRenderer
{
public CustomPickerBarRenderer(Context context)
: base(context)
{ }
protected override void OnElementChanged(ElementChangedEventArgs<Picker> e)
{
base.OnElementChanged(e);
if(Control != null && e.NewElement != null)
{
Control.SetPadding(Control.PaddingLeft, Control.PaddingTop - 10, Control.PaddingRight,
Control.PaddingBottom + 20);
}
}
}
}

View file

@ -5,7 +5,12 @@
<Style TargetType="Entry"
ApplyToDerivedTypes="True">
<Setter Property="Margin"
Value="-4, 0" />
Value="-4, 0, -4, -4" />
</Style>
<Style TargetType="Picker"
ApplyToDerivedTypes="True">
<Setter Property="Margin"
Value="-4, 0, -4, -4" />
</Style>
<!-- Buttons -->