Comments (6)
FloatingView executes a click event only for the top level view.
Therefore, please bridge the click event from MapViewRelativeView to Button.
public class MapRelativeLayout extends RelativeLayout{
LayoutInflater mInflater;
public MapRelativeLayout(Context context) {
super(context);
mInflater = LayoutInflater.from(context);
init();
}
public void init() {
View v = mInflater.inflate(R.layout.widget_map_relative_layout, this, true);
final Button btn = (Button) findViewById(R.id.button);
btn.setText("Testing");
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
Log.d("TEST", "Testing");
}
});
// Added:MapRelativeLayout's click
setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// call button event
btn.performClick();
}
});
}
}
from floatingview.
Sample code please
from floatingview.
Thanks YoshihideSogawa, that's work, but if I need to add more button in RelativeLayout, that does not work.
from floatingview.
MapRelativeLayout class
public class MapRelativeLayout extends RelativeLayout {
LayoutInflater mInflater;
Button btnA;
Button btnB;
public MapRelativeLayout(Context context){
super(context);
mInflater = LayoutInflater.from(context);
init();
}
public void init()
{
View v = mInflater.inflate(R.layout.widget_map_relative_layout, this, true);
btnA = v.findViewById(R.id.buttonA);
btnA.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
Log.d("Testing", "buttonA");
}
});
btnB = v.findViewById(R.id.buttonB);
btnB.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
Log.d("Testing", "buttonB");
}
});
}
}
from floatingview.
FloatingView only supports clicking of one View.
If you have an idea to modify please give me a Pull Request.
from floatingview.
from floatingview.
Related Issues (20)
- addViewToWindow() crashes with IllegalStateException HOT 10
- get the removing view instead of coordinate
- Laggy floatingview HOT 8
- NullPointerException on mVelocityTracker
- Can't move view on some devices HOT 3
- getDisplayCutout() on a null object reference HOT 5
- old bug (#88) HOT 2
- Support Android Q HOT 3
- sample not work.
- NPE in addMovement HOT 1
- android x migration HOT 1
- Crash on display with oreo 8
- Support Android P HOT 5
- Caused by: android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@990cb01 -- permission denied for window type 2038 HOT 2
- startObjectAnimation() only updates either X or Y
- Bugs on Galaxy S9+ HOT 7
- FloatingViewManager.removeAllViewToWindow() causes IllegalArgumentException HOT 1
- Floating view disappear in API level 26 HOT 1
- NullPointerException in onTouch, due to .getState() HOT 3
- Can't remove floating view HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from floatingview.