I was testing my android app on device by enabling device show layout boundaries in developer option on device.
I check my listview with inflated view with textviews , rating bar and other views clearly seen as shown below .
later I tried twitter app but surprise to see only single view ???
anyone know how to get twitter like single view on listview ??
anyone know how to get twitter like single view on listview ??
Each list item is a single custom View
object, not a ViewGroup
or layout. Essentially, all the content is drawn directly onto the Canvas
in onDraw()
rather than relying on child ImageView
and TextView
elements. Images can be drawn easily enough by calling Drawable.draw()
or Canvas.drawBitmap()
and text is typically drawing using a Layout
.
Additionally, this means all touch events are handled directly inside onTouchEvent()
to handle taps on the lower icons and/or the avatar image, so there are no click listeners.
Edit: Here's a quick 30 second example that should be enough to get you started: https://gist.github.com/devunwired/8704007
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With