splitwise / TokenAutoComplete

Gmail style MultiAutoCompleteTextView for Android
Apache License 2.0
1.3k stars 384 forks source link

Wrap Content width doesn't work for TokenCompleteTextView #356

Closed spung closed 6 years ago

spung commented 6 years ago

Hi, I am trying to use wrap_content for the width of my class which extends TokenCompleteTextView but this does not render correctly. I'd like for the width to wrap around the tokens present, so that any clicks to the right of the tokens will go to the underlying/parent layout. Is this possible?

mgod commented 6 years ago

Probably not. The token size is a little variable depending on the size fo the TokenCompleteTextView. There's no intrinsic size for the tokens (I'm assuming you're seeing tiny tokens with the view correctly wrapping them?), so there's not really a way to have the parent warp around them.

spung commented 6 years ago

Thanks for the quick reply. Any thoughts on workarounds to get the clicks propagating to the parent view when there's no token there?

mgod commented 6 years ago

I would probably set visibility to GONE until you needed it, but you could probably also use a touch or click listener on the edit text to forward events to your underlying view.

spung commented 6 years ago

Visibility won't work because I want this to happen when tokens are present. E.g. one token is displayed, any clicks to the right of it should go to the parent view. I'll investigate the second approach. If you think of anything else please let me know, thanks!

mgod commented 6 years ago

Ah, I misunderstood what you meant by "no token there". You meant that when the user clicks on the whitespace to the right of all the tokens, you want that click to go through, not just different behavior when there are 0 total tokens. This isn't possible as far as I know. #99 has some more discussion that might be helpful.