0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Android】入力方法を指定する方法

Last updated at Posted at 2021-01-13

プログラミング勉強日記

2021年1月13日
EditTextには数字用、パスワード用といった複数の入力タイプなど様々な入力方法の指定があるのでその方法を簡単にまとめる。

キーボードのタイプを指定する方法

 キーボードのタイプを指定するためには、EditTextタグにandroid:inputType属性を使う。

指定する値 説明 
text 通常テキストを入力する
textUrl URLを入力する(通常のキーボードに/が追加される)
number 数値を入力する
phone 電話番号を入力する(携帯電話型のキーボードになる)
<!-- Eメールアドレスを入力させたい場合 -->
<EditText
    android:id="@+id/editText"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:hint="@string/hint"
    android:inputType="textEmailAddress" />

キーボード入力時を指定する

 android:inputTypeでは、初めてキーボードで入力された文字はすべて大文字にする、文字を全てドットで隠すように表示するなど指定することができる。

指定する値 説明 
textCapSentences 先頭の文字のみを大文字にする
textCapWords 単語の先頭文字のみを大文字にする
textAutoCorrect 文字のスペルミスを自動で修正する
textMultiLine 複数行を入力する
<!-- 入力された文字をすべてドット表示にする -->
<EditText
    android:id="@+id/editText"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:hint="@string/password"
    android:inputType="textPassword"/>

参考文献

入力方法のタイプの指定

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?