Reputation: 13208
I have a ListView
which has three rows. The last 2 rows have EditText
fields which allow for editing. I have the xml for those two below:
<LinearLayout
android:id="@+id/id_message_subject_edit"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:orientation="vertical" >
<EditText
android:id="@+id/id_message_details_subject"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="left"
android:layout_margin="5dp"
android:gravity="left"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/BLACK"
android:textSize="15sp" />
</LinearLayout>
For some reason when I click on the EditText
, it just simply loses the cursor, but the keyboard is still visible. I'm not sure but it happens on both boxes. There is no TouchListener
or any other listener for that matter. Is there something special about putting inside of a ListView
that I need to be aware of?
EDIT
When I put the following in my manifest.xml file:
android:windowSoftInputMode="adjustPan"
I see that it works...however the ListView
won't scroll when the text goes below the keyboard. Is there a way to take care of that use case?
Upvotes: 2
Views: 464
Reputation: 13269
Is there something special about putting inside of a ListView that I need to be aware of?
Yes, remember that the ListView
wants to handle focus and click events, but now you have an EditText
in the mix. Check out the answers to this question.
However, if you only have 3 rows in your ListView
, you really aren't gaining much by using it. ListView
is designed to recycle views and be very efficient when you have many items in your list. If you only have a few rows, I'd suggest using a ScrollView
and adding your View
s (rows) to it, and simply handle the onClick
events yourself (if your list items are clickable).
Upvotes: 1