Android EditText doesn’t focus on touch
•
Android
My EditText looks like:
<EditText
android:id="@+id/uuidInput"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:textSize="14sp"
android:inputType="text"/>
But when I run my application, EditText doesn't focus on touch. I don't know why
I have a layout file beacon_ data_ Input.xml, which is contained in activity_ In main.xml
This is my input view beacon_ data_ input.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:id="@+id/inputLayout"
android:layout_height="match_parent"
android:gravity="center"
android:visibility="visible">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<com.nicbit.proximitydemo.common.customviews.RobotoCondensedTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Beacon UUID:"/>
<com.nicbit.proximitydemo.common.customviews.RobotoCondensedTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="* "
android:textColor="@color/red" />
<EditText
android:id="@+id/uuidInput"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:textSize="14sp"
android:focusableInTouchMode="true"
android:inputType="text"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<com.nicbit.proximitydemo.common.customviews.RobotoCondensedTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Beacon Major:"/>
<com.nicbit.proximitydemo.common.customviews.RobotoCondensedTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="* "
android:textColor="@color/red"/>
<EditText
android:id="@+id/majorInput"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:textSize="14sp"
android:focusableInTouchMode="true"
android:inputType="number"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<com.nicbit.proximitydemo.common.customviews.RobotoCondensedTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Beacon Minor:"/>
<com.nicbit.proximitydemo.common.customviews.RobotoCondensedTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="* "
android:textColor="@color/red"/>
<EditText
android:id="@+id/minorInput"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:textSize="14sp"
android:focusableInTouchMode="true"
android:inputType="number"/>
</LinearLayout>
activity_ Main.xml includes the following layouts:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:fitsSystemWindows="true">
<include layout="@layout/custom_toolbar" />
<include layout="@layout/beacon_data_input" />
<android.support.v7.widget.RecyclerView
android:layout_marginTop="56dp"
android:id="@+id/proximityRecycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="50dp"></android.support.v7.widget.RecyclerView>
<com.nicbit.proximitydemo.common.customviews.RobotoCondensedButton
android:gravity="center"
android:id="@+id/StartButton"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_gravity="bottom"
android:background="#292d2e"
android:textColor="#48c68f"
android:textSize="24sp"
android:layout_alignParentBottom="true"
android:text="Start"
/>
<LinearLayout
android:orientation="vertical"
android:id="@+id/imageLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>
</RelativeLayout>
Thank you in advance
resolvent:
Invalid Sign
Try placing it as follows (add edittextlayout above each layout):
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:fitsSystemWindows="true">
<android.support.v7.widget.RecyclerView
android:layout_marginTop="56dp"
android:id="@+id/proximityRecycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="50dp"></android.support.v7.widget.RecyclerView>
<com.nicbit.proximitydemo.common.customviews.RobotoCondensedButton
android:gravity="center"
android:id="@+id/StartButton"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_gravity="bottom"
android:background="#292d2e"
android:textColor="#48c68f"
android:textSize="24sp"
android:layout_alignParentBottom="true"
android:text="Start"
/>
<LinearLayout
android:orientation="vertical"
android:id="@+id/imageLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>
<!--- Add them in last -->
<include layout="@layout/custom_toolbar" />
<include layout="@layout/beacon_data_input" />
</RelativeLayout>
Invalid Sign
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码