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 <[email protected]> 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 <[email protected]> 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 <[email protected]> wrote:
>
> > > Hi, bump again.
>
> > > On Jul 8, 7:52 pm, eags <[email protected]> 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 <[email protected]> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to