![]() ![]() In GestureListener.onTouch, in addition to delegating to the gesture detector, I also had to return true for ACTION_UP and ACTION_CANCEL events. ![]() I also had to make some additions to Swathi's code to get what I wanted. :-( But if you're interested in this approach, read on. And I ask you, what kind of list doesn't fling? If you don't care about having fling support in your list, or if it's okay for the views to snap to the center at the end of the fling animation, then this will work for you! However, in the end it still proves impossible to remove the center-locking feature without removing fling support. Swathi EP below suggested that I give the Gallery an OnTouchListener and override the scroll functionality. If you're bold enough to do that, it's arguably the best solution, but I don't want to rely on undocumented methods that could change. The only way to truly override the Gallery's center-locking feature is to override the private scrollIntoSlots method, which I believe would require generating a subclass at runtime. Since asking this question, I have overridden AdapterView and implemented my own "HorizontalListView" from scratch. The only solution I've found so far is to do it all myself. Do y'all think that's a good practice? Does anyone have any tutorials or third-party solutions that might put me in the right direction? hopefully those classes aren't using some package-private variable I can't access. I suppose I could possibly copy both AbsSpinner and Gallery to get what I want. If you tell me it's easy to do, and that it's easy to roll my own RecycleBin, I'll be very skeptical but I'll give it a shot. But I'm sure that if I do that I'll run into some member field that's inaccessible or some other unforeseen consequence.ĪbsSpinner: Since the mRecycler field is package-private I doubt I'll be able to extend this class.ĪbsListView: It looks like this class is only meant for vertical scrolling, so no help there.ĪdapterView: I've never had to extend this class directly. Gallery: It looks like I could use the Gallery if I override most of the 'onXyz' methods, copy all their source code, but refrain from calling scrollIntoSlots(). ![]() I peeked into the source code for some of these classes. And I really don't want to write any layout code. Mostly, I could do what I want with a LinearLayout inside a ScrollView, but I need the child views to come from a ListAdapter and I would really like to have a view recycler. I don't really need ListView's listSelector but it's a nice-to-have. What I need is basically something exactly like the Gallery, but without the center-locking feature. Okay, now that I'm done fuming, let's talk about the problem itself. I'll be damned if I'm going to roll my own ListView, when all I want is to take the thing and turn it on its side. And, like many things in Android, the API doesn't even provide a reasonably extensible starting point. Like many things in Android, you wouldn't think this would be such a hard problem but ohhh, by golly, would you be wrong. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |