我想在Droid项目中使用BottomNavigationView(来自Xamarin.Android.Support v25)并编写了一个自定义渲染器。一切都很好,但我不能把它放在屏幕的底部:)我需要实现onLayout和onMeasure函数,但是当我这样写它时:
protected override void OnLayout(bool changed, int l, int t, int r, int b)
{
base.OnLayout(changed, l, t, r, b);
var c = _bottomBar.MeasuredHeight;
_bottomBar.Layout(0, 0, _bottomBar.MeasuredWidth, _bottomBar.MeasuredHeight+b-t);
var renderer = Platform.GetRenderer(_currentPage);
renderer.UpdateLayout();
}
protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
SetMeasuredDimension(widthMeasureSpec, heightMeasureSpec);
widthMeasureSpec = MeasureSpec.MakeMeasureSpec(widthMeasureSpec, MeasureSpecMode.Exactly);
heightMeasureSpec = MeasureSpec.MakeMeasureSpec(heightMeasureSpec, MeasureSpecMode.Exactly);
base.OnMeasure(widthMeasureSpec, heightMeasureSpec);
_bottomBar.Measure(widthMeasureSpec, heightMeasureSpec);
}
我在屏幕外面看到菜单的下半部分。如何改写这个?
P.S。请不要建议使用任何库,我需要使用本机库。