Focus issue on a listview with fastscrollbar enabled - android

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...

Related

Spinner losing focus after item is selected

I have a dialog with a bunch of EditTexts and Spinners. They are all inside a ScrollView and the dialog can sometimes be large enough for the scroll bar to be required.
When I select an item from a spinner, it will lose focus and switch to the first EditText in the dialog. When they are all shown on the screen, this is not a big problem, but when the spinner is on the bottom, it will auto scroll to the top to select the first EditText. And that's where it becomes very annoying.
I have tried calling requestFocus() on the spinner inside it's itemSelectedListener but it did not work. I had the same problem with buttons. When they were clicked, the focus would be switched to the first EditText, but requesting focus inside the button's click listener solved it.
EDIT:
I have noticed that the spinners were not focusable. After setting setFocusable and setFocusableInTouchMode to true, the first EditText would no longer get selected, but the viewpoint would still be scrolled to it. How do I prevent this?

Android ListView scrolls to top after visibility change of an item

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.

Android: ListView - state after scroll

I have a listview where I take control of the focus. When I reach the last visible position and click down the listview does not scroll. However, if I touch and scroll the listview then try to navigate the listview using my custom focus control, it works.
My question is what state does android put a listview in when the user touch and scrolls it?
I don't know what the problem was, but changing the Activity to a ListActivity solved the issue.

ListView scrolling with Up/Down button click bug

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.

Adding a button bar at the bottom of ListView upon checkbox select (as in Gmail app)?

I have a ListView with custom adapter. In each row there is a checkbox and couple of textviews. I want user to give option to delete the check marked items, so as soon as soon clicks on one of the checkbox, I want a button bar to slide in from the bottom and stay at the bottom regardless of listview scroll. This is something like the email app behavior of Motorola Cliq and to some extent gmail app itself.
I have tried adding a relativelayout (containing buttons) below the listview, which has visibility set to gone initially, but as soon as user checks a button, the visibility changes to "visible". I have added a slide-in animation to it too. It is working but problem is that it is overlapping the last element of the listview which user can not checkmark if the button bar has already become visible. So I tried to set the bottom margin of the listview equal to the height of the button bar when I'm changing the button bar visibility, which solves the problem of overlap, but now the checkbox behavior has gone weird. Clicking on one checkmark tries to checkmark another checkmark in the list for some weird reason. I noticed that this happens because as soon as I change the listview margin, list redraws itself, and during this new call to getView() method of adapter, things mess up.
I wanted to ask if anyone has done something like this. What is the best method to add such button bar below list while keeping the slide-in animation intact. Also, What is the footer-view of listview and can that solve my problem?

Categories

Resources