2017-06-12 5 views

答えて

1

この

<EditText 
    android:id="@+id/txtCapitalize" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:inputType="textCapSentences" /> 

EditText txtCapitalize = (EditText) findViewById(R.id.txtCapitalize); 
    txtCapitalize.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_WORDS); 

やAndroidを試してみてください:あなたのデバイスのキーボードオートが有効に設定大文字場合inputTypeは= "textCapSentencesは" のみ動作します。

+0

、私が試してみましたアンドロイドをご確認ください。 –

1

EditTextandroid:textAllCaps="false"に設定してください。 文字列は、toLowerCase(すべての文字列)とtoUpperCase(最初の文字)として機能するように、プログラムで変数を必要に応じて変更します。 XMLでinputType =「textCapSentences」それはまだWORKのみ表示されます。

1
String str = yourEditText.getText().toString(); 
str = str.toUpperCase().charAt(0) + str.substring(1); 
関連する問題