How to put default value in EditText in Android Studio -
i trying put value in edittext
can not.
the code edit:
<edittext android:textcolor="@color/white" android:id="@id/input_username" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margintop="20.0dip" android:hint="@string/input_username_hint" android:ems="10" android:singleline="true" android:maxlength="140" android:layout_below="@id/input_room_name" android:layout_centerhorizontal="true" />
when put android:text="user"
genarated apk not opening.
do this:
edittext.settext("your default text");
but if want show gray text disappears when user starts type, you're looking android:hint
.
on xml:
android:hint="your default text"
on java:
edittext.sethint("your default text");
Comments
Post a Comment