Issue
Here's my problem, I have a very simple layout displaying 2 EditText's, one for a title and other for a description. Here is the xml file:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1">
<EditText
android:layout_width="match_parent"
android:layout_height="63dp"
android:id="@+id/title_field"
android:background="#ffffffff"
android:hint="@string/titleFieldHint"
android:padding="20dp"
android:textSize="8.5pt"
android:maxLines="1"/>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray"/>
<EditText
android:layout_width="match_parent"
android:layout_height="0dp"
android:id="@+id/description_field"
android:hint="@string/descriptionHint"
android:gravity="top"
android:padding="20dp"
android:scrollbars="vertical"
android:textSize="8.5pt"
android:background="#ffffff"
android:inputType="textMultiLine"
android:textIsSelectable="true"
android:focusableInTouchMode="true" android:layout_weight="1"/>
</LinearLayout>
When I start the activity with this layout keyboard shows focusing title_field, and so I can write and click on the other field (while keyboard is still opened) and write a description. However, if I hide the keyboard it won't show up again (keyboard) unless I click on title_field, so description_field does not respond, besides title_field supports selection out of the box (including contextual action bar) while description_field won't let me even select.
I'm just beginning android development, is there something I am missing?
Solution
Take out android:textIsSelectable="true"
.
OR
Edit:
If you need to be able to keep the text to use as part of the new edit text:
Change android:hint to andoid:text to be able to use the text with the keyboard. However, it is still needing to go back to the first edittext if the keyboard is closed, it will then stay open for the second edtitext.
I would be using height as "wrap_content" for both edittext boxes.
<EditText
...
android:text="descriptionHint"
android:focusableInTouchMode="true"
android:textIsSelectable="true"
android:layout_weight="1"/>
Answered By - user3956566
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.