I'm building a Recyclerview populated with Textviews. The text must be selectable and I'm using the TextView#setTextIsSelectable(true) method to do that.
The problem is when I try to select the text of an item, it jumps to the top of the screen. I supose that the item is requesting the focus and this happen, but I don't want this behaviour, I want to select the text but without the RV jumping on each selection.
This is an example:
Related
I'm using a RecyclerView with list items that contain an EditText control with the android:imeOptions set to actionNext. When I tap the actionNext button on the on-screen keyboard the focus goes to the EditText control of the next list item as expected. If the focus is on the EditText of the last list item that is visible on the screen then the RecyclerView creates the next list item and its EditText control receives the focus as I would expect.
The problem I have is with what happens when I tap the actionNext button when the EditText control of the last list item of the entire collection of data items has the focus. I would like the RecyclerView to scroll to the top and set the focus on the EditText control of the list item which shows the first item of the data item collection, but the focus actually goes to the EditText control of the first list item that is visible.
For example if I have 8 items in my collection and only the last 5 items fit on the screen, when I tap the actionNext button on the EditText control of the last item, the focus goes to the EditText control of the 4th item instead of the 1st item as I'd like.
I tried to achieve this behavior using an OnKeyListener on the EditText control but it won't fire when I tap the actionNext button. Could someone point me in the right direction?
I've have a listview with some items inside it.
For some of these items, when the users clicks on a button, the buttons is hidden and a status label is showed.
This works fine, but the problem is that the listview scrolls to the top everytime I change the visibility of some item inside a listview.
Any suggestion to avoid this?
I want the listview to stay where it is.
I'm having an issue with a listview.
It's displaying items with a checkbox on the right.
When I enables the fastscrolling, everytime I press on the checkbox, the fastscrollbar appears and it scrolls to the position I pressed rather than just checking the checkbox...
If it matters I enable the fastscrollbar dynamically depending on the number of items in the list.
How can I fix this focus issue ?
Edit: In fact I'm also having the same issue without a checkbox. When I press on the right of the listview item, it doesn't open the item like it should but it scrolls to the position I pressed. Same behavior in a GridView...
As Shown in image 1: I have listview with 2 items(half empty),and at the top i have one serch box I complete search functionality with custom adapter and Filterable but i want some other thing with this .they are
want to scroll listview with half empty(By Default it scrollable when Items more than area)
Search box should also scroll with listview.(As shown in 2 picture.)
listview should be scroll up to last item (Here last item is Item2 should always shown )and item at top should highlighted with different color.
Scrollview can have only one direct child. So if you want to put more than one view in a single scrollview, you should put all the views you need to scroll, inside single container view eg:-linear layout and put those views in that.
I have a listview, which is scrollable, with dynamically items loaded from the database. And I have two buttons, "UP" for scrolling up by 100 pixels and "Down" for scrolling down by 100 pixels also.
The problem is that after I click down or up, the screen scrolls but after that all items in listview are not selectable at their right place. For example, I press down key and it scrolls well but after that I click item3 and it accepts item1 as clicked object.
I have tried ListView.refreshDrawableState() but it doesn't work.
You might want to use the setSelection() method instead of scrolling the list by 100 pixels each time. Increment the selection when you're scrolling down and decrement it while scrolling up. This will assure that the right item is being clicked. Hope this helps.