2016-07-27 9 views
0

ここに私のEditTextがあります.TextCapWordsはSamsungのキーパッドでは機能していません。 (サムスンS4)。回避策はありますか?textCapWordsがSamsungのキーボードで動作していません

<EditText 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginStart="16dp" 
     android:background="@android:color/transparent" 
     android:imeOptions="actionDone" 
     android:inputType="textCapWords" 
     android:maxLength="15" 
     android:padding="12dp" 
     android:textSize="20sp" /> 

答えて

1

XMLでこれを試してみてください。この一部のデバイスのキーボードを使用し

android:textAllCaps="true" 
+1

txtAllCapsとtextCapWordsは異なるものです –

+0

textCapCharactersはAndroid 7のSamsungキーボードで動作しなくなりました。だから、頼まれたものは正確ではないのに、あなたは私から投票を得ることができます:) – Moth

0

capWordsをサポートしたり、

このコードEDITTEXT各単語の最初の文字の資本を設定するには無効になりません。

youredittext.addTextChangedListener(new TextWatcher() { 
     @Override 
     public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { 

     } 

     @Override 
     public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { 

     } 

     @Override 
     public void afterTextChanged(Editable editable) { 
      String capitalizedText = WordUtils.capitalize(youredittext.getText().toString()); 
      if (!capitalizedText.equals(youredittext.getText().toString())) { 
       youredittext.addTextChangedListener(new TextWatcher() { 
        int mStart = 0; 
        @Override 
        public void beforeTextChanged(CharSequence s, int start, int count, int after) { 

        } 

        @Override 
        public void onTextChanged(CharSequence s, int start, int before, int count) { 
         mStart = start + count; 
        } 

        @Override 
        public void afterTextChanged(Editable s) { 
         youredittext.setSelection(mStart); 
         youredittext.removeTextChangedListener(this); 
        } 
       }); 
       youredittext.setText(capitalizedText); 
      } 
     } 
    }); 

WordUtils

https://www.dropbox.com/s/olfjyhfrghxvfs2/orgwordutils.jar?dl=0

1

をインポートするには、jarファイルをダウンロードして、あなたはプログラム的にしようとしましたか?

youredttxt.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_WORDS); 

OR

android:inputType="textCapWords|textCapSentences" 

OR

私の知る限り、この1が推奨されていませんが、私はそれが仕事をしたりしませんかわからないが、あなたが試すことができ、

​​
0

これを試すことができます...私のために働いた...

android:inputType="textCapWords" 

それとも

android:inputType="textCapSentences" 

それとも

android:inputType="textCapWords" 

サムスンS5/S7用キャップで最初の用船を作るための "自動大文字" という名前の設定で追加設定があります。

関連する問題