###前提・実現したいこと
Activity起動時に 設置しているEditTextに文字を入力したいです。
Text Viewでは出来るのですが、EditTextの場合は文字が入力されません。
###試したこと
onCreate内にて
TextView empty_text = (TextView)findViewById(R.id.empty_text);
EditText input_board = (EditText)findViewbyId(R.id.input_board);
EditText answer_display = (EditText)findViewbyId(R.id.answer_display);
empty_text.setText("aa");
input_board.setText("aa")
answer_display.setText("aa");
と記述すると、TextViewにはaaと表示されるのですが、EditTextには何も表示されません。
どうすればいいでしょうか?
<EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/input_board" android:singleLine="true" android:gravity="right" android:textSize="20sp" android:layout_marginTop="10dp" android:inputType="textNoSuggestions" />
<EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/answer_display" android:textSize="22dp" android:gravity="right" android:singleLine="true" android:inputType="textNoSuggestions" android:background="#00000000" android:layout_marginTop="10dp" android:focusable="false" android:focusableInTouchMode="false" />
<TextView android:layout_width="match_parent" android:layout_height="0dp" android:id="@+id/empty_text" android:layout_weight="1" />
上記2つのEditTextには、どちらも起動時に文字を入力させることができません。
Text Viewには起動時に入力させることが出来ます!
回答2件
あなたの回答
tips
プレビュー