Android
Android This text field does not specify an inputType or a hint
Androidのレイアウトファイルで、入力フォームを表示する部分で、黄色のエラーで上記のようなエラーが表示されることがあります。
<EditText
android:id="@+id/nick_name"
android:layout_width="230dip"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
>
android:inputTypeという、パラメーターが足りないということのようです。
<EditText
android:id="@+id/nick_name"
android:layout_width="230dip"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:inputType="text" >
一番最後にinputTypeを付与してなおりました!
ちなみに、
<EditText
android:id="@+id/email"
android:layout_width="230dip"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:inputType="text" >
とか書くと、これも下記のエラーが表示されます。
The view name (@+id/email) suggests this is an e-mail address, but it does not include ‘textEmail’ in the inputType
どうやらこれはEmailを入力するフォームのようだけど、テキストタイプがEmailになっていないよ、ということのようです。
<EditText
android:id="@+id/email"
android:layout_width="230dip"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:inputType="textEmailAddoress" >
ちなみに、上記はtextEmailだとエラーになります。textEmailAddoressが正解です。
他にも、下記で
<EditText
android:id="@+id/phone_number"
android:layout_width="230dip"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:inputType="text" >
The view name (@+id/phone_number) suggests this is a phone number, but it does not include ‘phone’ in the inputType
と出ます。正しくは、下記ですね。
<EditText
android:id="@+id/phone_number"
android:layout_width="230dip"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:inputType="phone" >
どうですか?
Androidの開発環境さん、優しくないですか?!
ぁたし なぃちゃったよ…w
idに適当な文字を割り振るのではなくて、ちゃんとテキストフォームの属性を指定する名前をつけるべし、です。