Bump. Mystery remains. Why can the entire ListView item not be made clickable???
On Jul 9, 7:57 pm, eags <eagsala...@gmail.com> wrote: > And I tried making sure the first sub LinearLayout was not fill_parent > for width or height. No dice. > > On Jul 9, 7:52 pm, eags <eagsala...@gmail.com> wrote: > > > Anyone?? Total mystery. I played around with .bringToFront() and > > friends with no avail. I'm thinking the issue is simply that the list > > item is simply completely covered by its children but that doesn't > > really explain why TextView does work even when it is set to > > fill_parent. > > > On Jul 9, 5:11 pm, eags <eagsala...@gmail.com> wrote: > > > > So I methodically tried removing items from my top level LinearLayout > > > in the list item layout until clicking started working at the top > > > level. It turns out that with LinearLayout, you can only have one > > > child (total, not just immediate children) before clicking stops > > > working. Then I found some example code where this works but they are > > > using RelativeLayout and if you try to nest a LinearLayout inside it > > > also stops working. > > > > Honestly this all seems like utter nonsense to me. Is there someone > > > who can explain things or point to a document so that all this makes > > > some sense?? > > > > Right now it seems like my options are, redo all my layouts using only > > > relative (which just won't work for a more complicated layout like > > > this one) or set a sub-element to be clickable and do the dance to > > > figure out which list element that corresponds to. > > > > Thanks again in advance for any information explaining this. > > > > On Jul 9, 4:28 pm, eags <eagsala...@gmail.com> wrote: > > > > > I did what you said and it worked. This is actually exactly what the > > > > Alarm Clock application does since when you click on an alarm it > > > > doesn't select the entire ListView element but just the clock and > > > > message. However I still have a couple problems with this: > > > > > 1. Why??? I find this behavior to be very confusing especially when > > > > other simpler list view item layouts work just fine at the top level > > > > (for example browser options clicking selects the entire element > > > > including the checkbox which is what I want) > > > > 2. This actually really screws up my code because now my > > > > OnItemClickListener which was returning to me the index which is > > > > useful now just has a reference to the element. I could probably > > > > figure out the index either way but it seems like a pointless mess. > > > > > Is there some piece of documentation you could point me to that > > > > explains what is going on here? It seems very quirky to me. > > > > > On Jul 8, 11:20 pm, Radzell <basketballd...@gmail.com> wrote: > > > > > > It looks like what you need is not to put android clickable in the > > > > > view group but in the individual view that you want to make clickable > > > > > ie > > > > > <?xml version="1.0" encoding="utf-8"?> > > > > > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ > > > > > android" > > > > > android:orientation="horizontal" > > > > > android:gravity="center_vertical" > > > > > android:layout_width="fill_parent" > > > > > android:layout_height="fill_parent" > > > > > android:clickable="true"> > > > > > > <LinearLayout > > > > > android:layout_height="wrap_content" > > > > > android:layout_width="wrap_content" > > > > > android:paddingLeft="10sp" > > > > > android:layout_weight="1" > > > > > android:orientation="vertical" > > > > > android:clickable="true" android:focusable="true" > > > > > android:focusableInTouchMode="true"> > > > > > <LinearLayout > > > > > android:layout_height="wrap_content" > > > > > android:layout_width="fill_parent" > > > > > android:gravity="bottom" > > > > > android:orientation="horizontal" > > > > > android:clickable="true" > > > > > //like this make the individual linearllayou clickable not the group > > > > > then make the click lister t test with a toast > > > > > > On Jul 9, 1:32 am, eags <eagsala...@gmail.com> wrote: > > > > > > > Hi, bump again. > > > > > > > On Jul 8, 7:52 pm, eags <eagsala...@gmail.com> wrote: > > > > > > > > Bump. > > > > > > > > Hi someone please? I think this is probably something pretty > > > > > > > simple > > > > > > > that I'm just missing. > > > > > > > > Thanks. > > > > > > > > On Jul 8, 1:20 pm, eags <eagsala...@gmail.com> wrote: > > > > > > > > > I created a custom layout and adapter for a list view but now I > > > > > > > > cannot > > > > > > > > make it clickable? Is there anything to look out for here? My > > > > > > > > list > > > > > > > > item looks almost exactly like the alarms in the Alarm Clock > > > > > > > > app that > > > > > > > > comes installed with Android. Everything seems to work fine > > > > > > > > but now > > > > > > > > clicking on the list item does nothing. > > > > > > > > > I tried setting android:clickable=true and > > > > > > > > android:focusable=true > > > > > > > > (which already works because I can select using the trackball > > > > > > > > but I > > > > > > > > was just trying random things. > > > > > > > > > I can post code here if anyone needs more details. Thanks in > > > > > > > > advance > > > > > > > > for any help. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---