Oh! In that case I think the behavior you are observing is by design. Have a look at this thread:
http://groups.google.com/group/android-developers/browse_thread/thread/3d96af1530a7d62a/9f9919a4b604c104?lnk=gst&q=clickable+focusable#9f9919a4b604c104 On Feb 19, 4:09 pm, Selmi <[email protected]> wrote: > I am not able to find out how to do it. Now i am sure that its because > i capture onClick for embedded TextView. I tried to do this in > handler: > > v is clicked TextView > final View view=(View)(v.getParent()); //to get RelativeLayout which > is list item > final Drawable drawable=getListView().getSelector(); > view.setBackgroundDrawable(drawable); > view.invalidate(); > > idea was that this will set list selector as background and it will > look like it should. but in reality it draws selector to wrong item! > and sooner or later several selectors appear on screen... so this is > not solution. i am afraid i am not understanding something fundamental > > On 18. Feb, 01:55 h., Selmi <[email protected]> wrote: > > > i found what is problem > > > in layout which is used by list item i have several controls. for > > simplicity i narrowed it down to checkbox and textview > > > i want to do such thing that if you touch checkbox then one action > > happens, if you touch something else (textview in my case) then > > something else happens > > if you press navigation button then i choose one of these actions in > > program > > > and this is problem. i don't know which view inside list item was > > pressed when i get into onListItemClick method. so i added > > onCheckedChangeListener to checkbox to know if something happens. > > still everything works. then i added onClickListener to remaining > > textview control, and since then there is no visible flash of focus, > > but instead color changes to black > > > so problem really seems to be in this onClickListener. i guess issue > > is that because i catch click in textview it won't get into ListView > > processing. > > > i tried to use LayoutInflater to get layout for > > android.R.layout.simple_list_item_1, then get color states for its > > text1 and set it for my textview in hope it will behave the same then. > > it doesn't. > > > so to solve this i see two ways and none of them i know how to do > > > 1 - do something so i will know which exactly view was pressed when i > > get to onListItemClick method. this would be the best solution if its > > possible > > 2 - find a way how to set my textview to exactly same color states > > which are used by list by default > > 3 - maybe something else i don't know what. this list selector idea i > > don't like much because for i have to make it look and behave exactly > > the same as android does it by default (this is condition i can't > > argue about) > > > any idea? > > > On 17. Feb, 04:36 h., Romain Guy <[email protected]> wrote: > > > > The problem is probably that your list item is opaque. The selector > > > is, by default, drawn *behind* the list item. either use a different > > > selector, or draw it on top (which requires a different selector > > > anyway since the default one is opaque) or make your list items' > > > background support the selected state. > > > > Also, instead of setting a single solid color, you should use colors > > > that support states. > > > > On Mon, Feb 16, 2009 at 6:59 PM, Greg Krimer <[email protected]> wrote: > > > > > Hi, can you check out this thread to see if it is the same problem you > > > > are > > > > having:http://groups.google.com/group/android-developers/browse_thread/threa... > > > > > Basically, try setting the text color to an explicit value (as opposed > > > > to a style). > > > > > Also, have a look > > > > at:http://developer.android.com/reference/android/widget/AbsListView.htm...) > > > > or its XML equivalent android:listSelector. > > > > > If neither of these help, post your code. > > > > > On Feb 16, 2:46 pm, Selmi <[email protected]> wrote: > > > >> when i have listview and i use some listadapter provided by android > > > >> api then when you touch item in list it flashes with orange colour and > > > >> then action is processed > > > > >> if i have my own adapter this flash doesn't happen. instead text color > > > >> changes to black for a moment (and becomes unreadable) is there > > > >> something special i need to do to enable it? > > > > >> my adapter is actually based on cursoradapter and all it does is that > > > >> it adds onClick handlers to some of controls used in list item layout > > > >> and sets values of some widgets which are not handled by > > > >> simplecursoradapter by default > > > > -- > > > Romain Guy > > > Android framework engineer > > > [email protected] > > > > Note: please don't send private questions to me, as I don't have time > > > to provide private support. All such questions should be posted on > > > public forums, where I and others can see and answer them --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

