Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

设置StatusBarUtil之后,影响软键盘的弹出 #43

Open
YuYongzhi opened this issue Sep 22, 2016 · 22 comments
Open

设置StatusBarUtil之后,影响软键盘的弹出 #43

YuYongzhi opened this issue Sep 22, 2016 · 22 comments

Comments

@YuYongzhi
Copy link

activity的页面使用Rele布局,然后在底部放置EditText,点击输入框,软键盘弹出,但是输入框没有跟随向上滑

@laobie
Copy link
Owner

laobie commented Oct 20, 2016

输入框这个应该需要你设置下相关的属性吧,这个和设置状态栏应该没关系的,不知道你现在解决了没

@ailiboy520
Copy link

今天我也遇到这个问题 在清单文件设置 android:windowSoftInputMode="adjustResize|stateHidden"
后点击输入框,没有跟随,去掉这个状态栏后显示就可以的
具体布局是这样的



    <ImageView
        android:id="@+id/login_bg"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="fitXY"
        android:src="@mipmap/bg_login"
        />
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:orientation="vertical"
        >
        <ImageView
            android:layout_width="200dp"
            android:layout_height="50dp"
            android:scaleType="fitXY"
            android:src="@mipmap/image_water_mark"
            />
    </LinearLayout>

</RelativeLayout>

<TextView
    android:id="@+id/login_center"
    android:layout_width="match_parent"
    android:layout_height="1px"
    android:layout_centerInParent="true"
    />
<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_below="@+id/login_center"
    android:scrollbars="none"
    >
    <LinearLayout
        android:id="@+id/login_edit_contanter"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_marginBottom="@dimen/edit_bottom_margin"
        android:paddingLeft="@dimen/common_left_padding"
        android:paddingRight="@dimen/common_right_padding"
        >
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/common_left_margin"
            android:layout_marginRight="@dimen/common_right_margin"
            android:orientation="horizontal"
            >
            <TextView
                android:layout_width="85dp"
                android:layout_height="@dimen/input_box_height"
                android:paddingLeft="@dimen/edit_left_padding"
                android:text="@string/account"
                android:gravity="center|left"
                style="@style/input_login_box_style"
                />
            <EditText
                android:id="@+id/et_account"
                android:layout_width="match_parent"
                android:layout_height="@dimen/input_box_height"
                android:background="@color/transparent"
                android:layout_marginLeft="20dp"
                android:digits="@string/user_name_valid_char"
                android:singleLine="true"
                style="@style/input_login_box_style" />

        </LinearLayout>
        <TextView
            android:layout_width="match_parent"
            android:layout_height="1px"
            android:background="@color/login_text_cseparate_color"
            />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/common_left_margin"
            android:layout_marginRight="@dimen/common_right_margin"
            android:orientation="horizontal"
            >
            <TextView
                android:layout_width="85dp"
                android:layout_height="@dimen/input_box_height"
                android:paddingLeft="@dimen/edit_left_padding"
                android:text="@string/password"
                android:gravity="center|left"
                style="@style/input_login_box_style"
                />
            <EditText
                android:id="@+id/et_password"
                android:layout_width="match_parent"
                android:layout_height="@dimen/input_box_height"
                android:background="@color/transparent"
                android:layout_marginLeft="20dp"
                android:singleLine="true"
                android:inputType="textPassword"
                style="@style/input_login_box_style"
                />

        </LinearLayout>


        <TextView
            android:layout_width="match_parent"
            android:layout_height="1px"
            android:background="@color/login_text_cseparate_color"
            />


        <Button
            android:id="@+id/btn_login"
            android:layout_width="match_parent"
            android:layout_height="@dimen/common_btn_height"
            android:layout_marginTop="@dimen/btn_top_margin"
            android:layout_marginLeft="@dimen/common_left_margin"
            android:layout_marginRight="@dimen/common_right_margin"
            android:text="@string/login"
            android:textColor="@color/login_btn_text_color"
            android:background="@drawable/selector_button"
            style="@style/unify_button_style" />

        <TextView
            android:id="@+id/tv_login_forget"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="20dp"
            android:layout_marginBottom="20dp"
            android:textColor="@color/login_text_forget_color"
            android:textSize="@dimen/common_text_size"
            android:text="@string/forget"
            android:layout_gravity="center_horizontal"
            />
    </LinearLayout>
</ScrollView>

@tanweijiu
Copy link

这个跟透明状态栏有关,你的设备是5.0以后的版本么?

@beanu
Copy link

beanu commented Dec 8, 2016

有同样的问题,使用 StatusBarUtil.setTransparentForImageView(this, rlHeader);之后 软键盘不弹出,去掉之后 就可以了。5.0以上系统

@beanu
Copy link

beanu commented Dec 8, 2016

状态栏透明会影响软键盘的弹出,应该是系统的问题,不是StatusBarUtil的问题。临时解决方案是用了 StatusBarUtil.setColor

@ShaunWilson
Copy link

我也遇到了同样的问题,给键盘的enter键设置成搜索失效了

@LingChenJie
Copy link

我也遇到了,在小米手机上,如果设置状态栏透明度,就会出现软键盘把EditText给遮住。

@laobie
Copy link
Owner

laobie commented Mar 8, 2017

😔

@wangshaolei
Copy link

@laobie 这个问题最佳兼容实践有人实验过没有

@tanweijiu
Copy link

问题是出在,addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS),这个flag,是会影响键盘的,键盘弹出布局自动适配这个效果是会受到多种因素影响的,比如全屏或者....(建议看看相关的资料)

@wangshaolei
Copy link

@tanweijiu thanks~ 有解决方案分享一下,一起看一下。

@wangshaolei
Copy link

@tanweijiu 这里面两个方法试过了,没起作用。还有我是配合https://blog.dreamtobe.cn/2015/09/01/keyboard-panel-switch/
这个使用StatusBarUtil的

@laobie
Copy link
Owner

laobie commented Apr 6, 2017

@wangshaolei 透明会影响?setColor 会出现问题不

@wangshaolei
Copy link

@laobie setColor不会出现问题。是FLAG_TRANSLUCENT_STATUS这个影响的,我也是昨天晚上发现的。

@wangshaolei
Copy link

@OverRide
public final WindowInsets onApplyWindowInsets(WindowInsets insets) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
return super.onApplyWindowInsets(insets.replaceSystemWindowInsets(0, 0, 0, insets.getSystemWindowInsetBottom()));
} else {
return insets;
}
}
重写这个adJustResize 虽然有变化了,但是键盘的显示事件监听不到了。很纠结。@tanweiju

@tanweijiu
Copy link

@wangshaolei https://code.google.com/p/android/issues/detail?id=5497 然后你可以搜索一个工具类(AndroidBugSolutionAboutInputMethod.java)...

@wangshaolei
Copy link

@tanweijiu 没有搜到呢,有没有地址?thanks

@wangshaolei
Copy link

@tanweijiu 有没有很好解决方法呢,请教一下,你说的这个地址 貌似没有找到相关信息,谢谢~

@shlockfan
Copy link

如果是透明状态栏,把布局改成relativeLayout,然后想要顶起的布局放到bottom,就能顶起来了,你们可以试下,我以前遇到过。

@ruanbaojun1105
Copy link

同遇到 所以就没用透明了 好坑

@laobie
Copy link
Owner

laobie commented Jul 18, 2017

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants