0

我的应用程序中有一个 EditText 字段,用户可以在其中输入数据。该应用程序以编程方式处于全屏模式。问题在于,在某些手机(Honor P Smart)上,“完成”按钮不再可见,正如您在图片中看到的那样。

此问题仅在一周前出现,在手机(Honor P Smart)收到更新(固件 fig-lx1 8.0.0.140 (c02))之后。在更新之前,“完成”按钮可见。我应该提到 SwiftKey 不是问题的根源,因为我在其他手机上尝试过使用 SwiftKey 并且效果很好。

另外:为什么第二个是全屏的,而第一个不是?如何强制全屏?

这是 EditText 字段的 xml 代码:

<EditText 
    android:id="@+id/label" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginEnd="@dimen/margin_left" 
    android:layout_marginStart="@dimen/margin_left" 
    android:cursorVisible="false" 
    android:imeActionLabel="@string/done" 
    android:hint="@string/something" 
    android:imeOptions="actionDone" 
    android:inputType="textVisiblePassword" 
    android:lineSpacingExtra="6sp" 
    android:textColor="@color/color_x" 
    android:textSize="32sp" />

我通过以下方式设置监听器:

view.enar_button_label.setOnEditorActionListener { textView, actionID, keyEvent ->
    if (actionID == EditorInfo.IME_ACTION_DONE) {
        // hiding keyboard, because for some reason, it does not hide automatically
        (activity!!.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager).hideSoftInputFromWindow(view.enar_button_label.windowToken, 0)
        // soome stuff...
        (activity as MainActivity).setImmersiveMode()
        return@setOnEditorActionListener true
    }
    return@setOnEditorActionListener false
}

荣耀P智能

其他手机

任何帮助,将不胜感激!

4

2 回答 2

0

@blade 只需在您的编辑文本标签中添加以下行。那么问题就解决了。

android:singleLine="true"

如果您遇到任何问题,请告诉我。

于 2021-03-03T06:18:31.863 回答
0

尝试这个:

xml代码:


           <EditText
            android:id="@+id/login_email"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/margin_30"
            android:layout_marginRight="@dimen/margin_30"
            android:layout_marginBottom="@dimen/margin_20"
            android:gravity="center"
            android:hint="@string/username"
            android:maxLength="40"
            android:padding="@dimen/padding_10"
            android:imeOptions="actionDone"
            android:singleLine="true" />

在 EditText 中添加这个

android:imeOptions="actionDone"

爪哇代码:


     emailedit = (EditText) findViewById(R.id.login_email);

     emailedit.setImeOptions(EditorInfo.IME_ACTION_DONE);

在代码中设置行

emailedit.setImeOptions(EditorInfo.IME_ACTION_DONE);

我已经检查了多个设备对我的工作

我希望它可以帮助你

于 2019-02-13T05:32:25.177 回答