BijoySingh / Floating-Bubble-Library-Android

Simple library to add Floating Bubble into your app!
69 stars 29 forks source link

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

Open aZyreTech opened 5 years ago

aZyreTech commented 5 years ago

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

michio-mada commented 5 years ago

Get the view via getExpandableView()

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

ismailnurudeen commented 4 years ago

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{
}