我想添加一个选择器与背景图像,所以我使用了相对布局,并在相对布局中添加了图像和选取器。 我的问题是我在IOS的环境中有一个边框,我在android设备中有一个底线。 我在正常输入中遇到了这个问题并解决了问题,但我在拾取器不起作用的情况下使用了相同的场景。如何删除IOS中的选择器边框
这里是代码
<RelativeLayout Margin="0,0,0,0"
Padding="0,0,0,0"
>
<Image Source="input_mobile_code_brown.png"
x:Name="img"
RelativeLayout.XConstraint =
"{ConstraintExpression Type=RelativeToParent,
Property=Width,
Factor=0,
Constant=0}"
RelativeLayout.YConstraint =
"{ConstraintExpression Type=RelativeToParent,
Property=Height,
Factor=0,
Constant=0}"
RelativeLayout.WidthConstraint =
"{ConstraintExpression Type=RelativeToParent,
Property=Width,
Factor=1,
Constant=0}"
RelativeLayout.HeightConstraint =
"{ConstraintExpression Type=RelativeToParent,
Property=Height,
Factor=1,
Constant=0}"
/>
<Picker BackgroundColor="Transparent"
x:Name="picker"
Margin="10,0,0,0"
RelativeLayout.XConstraint =
"{ConstraintExpression Type=RelativeToParent,
Property=Width,
Factor=0,
Constant=0}"
RelativeLayout.YConstraint =
"{ConstraintExpression Type=RelativeToParent,
Property=Height,
Factor=0,
Constant=0}"
RelativeLayout.WidthConstraint =
"{ConstraintExpression Type=RelativeToView,
ElementName=img,
Property=Width,
Factor=1,
Constant=0}"
RelativeLayout.HeightConstraint =
"{ConstraintExpression Type=RelativeToView,
ElementName=img,
Property=Height,
Factor=1,
Constant=0}"
/>
</RelativeLayout>
- 这是结果
我需要从IOS
删除默认的边境所以我做了customRenderer在IOS
protected override void OnElementChanged(ElementChangedEventArgs<Picker> e)
{
base.OnElementChanged(e);
var view = e.NewElement as CustomPicker;
this.Control.BorderStyle= UITextBorderStyle.None;
}
但仍是边境IOS
不工作的兄弟! –
@SumitPathak,你有像@Victor Faltas一样的Picker自定义渲染器吗?请确保您完成了@Victor Faltas所描述的所有事情,只需将'Picker'更改为'local:CustomPicker'即可。 –