「Android/UIEditText」の版間の差分
提供: 初心者エンジニアの簡易メモ
| 行25: | 行25: | ||
<pre> | <pre> | ||
EditText editText = (EditText)findViewById(R.id.searchBox); | EditText editText = (EditText)findViewById(R.id.searchBox); | ||
| − | Log.d("edittext", | + | Log.d("edittext", editText.getText().toString()); |
</pre> | </pre> | ||
2019年8月28日 (水) 16:51時点における版
res/layout/~.xml
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="search:"
/>
<EditText
android:id="@+id/searchBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:hint="searchword..."
android:singleLine="true"
/>
</LinearLayout>
java
EditText editText = (EditText)findViewById(R.id.searchBox);
Log.d("edittext", editText.getText().toString());
