imeOptions =“ actionSend”在材料设计中不起作用

时间:2019-07-18 16:41:56

标签: android imeoptions

我想在我的inputText键盘上应用send操作,但是我仍然看到默认的箭头,而不是send按钮。 我还尝试了几种不同版本的设备,问题仍然存在。

XML:

 <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/layout"
        style="@style/AppEditText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/dimen_16"
        android:layout_marginEnd="@dimen/dimen_16"
        app:counterMaxLength="9"
        app:helperText="@string/idnow_landing_helper_text"
        app:helperTextEnabled="true"
        app:layout_constraintBottom_toTopOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="parent">

    <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/edit_text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@android:color/white"
            android:digits="ABCDEFGHIJKLMNOPQRSTUVWXYZ-"
            android:imeOptions="actionSend"
            android:inputType="textCapCharacters"
            android:maxLength="9"
            android:textColor="@color/grayDark"/>
</com.google.android.material.textfield.TextInputLayout>

活动:

 override fun onCreate(savedInstanceState: Bundle?) {
     ...
      findViewById<EditText>(R.id.edit_text).setOnEditorActionListener { v, actionId, event ->
        return@setOnEditorActionListener when (actionId) {
            EditorInfo.IME_ACTION_SEND -> {
                //do things
                true
            }
            else -> false
        }
    }
 }

2 个答案:

答案 0 :(得分:1)

在下方替换TextInputEditText

    BouncyCastleProvider provider = new BouncyCastleProvider();
        Security.addProvider(provider);
        PdfReader reader;
        reader = new PdfReader(bytes);
        AcroFields af = reader.getAcroFields();
        ArrayList<String> names = af.getSignatureNames();
            for (int k = 0; k < names.size(); ++k) {

                                String name = (String)names.get(k);
                                PdfPKCS7 pk = af.verifySignature(name);
                                Calendar cal = pk.getSignDate();
                                Certificate pkc[] = pk.getCertificates();
                                List<VerificationException> fails = CertificateVerification.verifyCertificates(pkc, ks, null, cal);
                                boolean certificateVerified = (fails.isEmpty())?true:false;
                                boolean documentModified= !pk.verify();}

您将在键盘上看到“发送”按钮,并且还会收到活动中的回叫。

让我知道更多帮助。

答案 1 :(得分:0)

解决方案正在添加:

android:singleLine="true"

结果:

<com.google.android.material.textfield.TextInputEditText
            android:id="@+id/edit_text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@android:color/white"
            android:imeOptions="actionSend"
            android:inputType="textCapCharacters"
            android:singleLine="true"
            android:digits="ABCDEFGHIJKLMNOPQRSTUVWXYZ-"
            android:maxLength="9"
            android:textColor="@android:color/black"/>