Floating-Bubble-Library-Android icon indicating copy to clipboard operation
Floating-Bubble-Library-Android copied to clipboard

How to get the click event of layout inside the bubble?

Open aZyreTech opened this issue 6 years ago • 2 comments

suppose i have a button inside bubble layout then how do i get the click event of that button ?

aZyreTech avatar Oct 02 '19 04:10 aZyreTech

Get the view via getExpandableView()

from there you can set View.OnClickListener for your button.

michio-mada avatar Dec 01 '19 06:12 michio-mada

The easiest way is to save a reference to the view after inflating and use findViewById to get any view inside of it which you can set a click listeners on.

i.e In kotlin

val bubbleLayout=LayoutInflater.from(context).inflate(R.layout.your_layout,null)

Then do;

bubbleLayout.findViewById<Button>(R.id.my_button).setOnClickListener{
}

or even shorter,

bubbleLayout.my_button.setOnClickListener{
}

ismailnurudeen avatar Jan 12 '20 20:01 ismailnurudeen