【问题标题】:When windowSoftInputMode=“adjustResize” with translucent action/navbar it' take time to show and hide keybaord当 windowSoftInputMode=“adjustResize” 带有半透明操作/导航栏时,显示和隐藏键盘需要时间
【发布时间】:2019-07-26 11:46:20
【问题描述】:

windowSoftInputMode=“adjustResize” 不适用于半透明动作/导航栏 所以我创建了自定义布局

public class CustomRelativeLayout:RelativeLayout
{
    private int[] mInsets = new int[4];

    public CustomRelativeLayout(Context context) : base(context)
    {
    }

    public CustomRelativeLayout(Context context, IAttributeSet attrs) : base(context, attrs)
    {
    }

    public CustomRelativeLayout(Context context, IAttributeSet attrs, int defStyleAttr) : base(context, attrs, defStyleAttr)
    {
    }


    public override WindowInsets OnApplyWindowInsets(WindowInsets insets)
    {
        if (Build.VERSION.SdkInt >= Build.VERSION_CODES.KitkatWatch)
        {
            //insets.ReplaceSystemWindowInsets(0, 0, 0, insets.SystemWindowInsetBottom);
            return base.OnApplyWindowInsets(insets.ReplaceSystemWindowInsets(0,0,0, insets.SystemWindowInsetBottom));
        }
        else
        {
            return insets;
        }
    }


}

但是显示和隐藏键盘需要时间,甚至需要时间来推动布局。怎么解决???

【问题讨论】:

    标签: android xamarin.android


    【解决方案1】:

    添加以下属性

    android:fitsSystemWindows="true"
    

    在片段.xml布局的根RelativeLayout中。

    这里有一个类似的issue,你可以参考一下。

    猜你喜欢
    • 2014-02-01
    • 1970-01-01
    • 2021-06-20
    • 1970-01-01
    • 1970-01-01
    • 2014-09-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多