Today I will share with you an example Android, currently edittext events are used most by applications that can be applied in practice.
How to remove auto focus from EditText in Android
Step 1. Create a layout activity_main.xml
<RelativeLayoutResults of the program:
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rl"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp"
tools:context=".MainActivity"
android:background="#d4c5b8"
android:focusable="true"
android:focusableInTouchMode="true"
>
<EditText
android:id="@+id/et"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:hint="Input your country"
android:padding="10dp"
/>
<EditText
android:id="@+id/et_city"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:hint="Input your City"
android:padding="10dp"
android:layout_below="@+id/et"
/>
</RelativeLayout>
No comments:
Post a Comment