First, inherit the view that needs to be expanded, and then add one of your own event methods, for example,
Oniconclick (MyInterface pinterface) {
Minterface = Pinterface;
}
Where MyInterface is a custom interface with custom methods such as OnClick, Minterface is an instance of a custom interface that passes the obtained instance to that instance
Next, determine the condition in the event that needs to be extended, such as onkeydown, and call the corresponding method of Minterface
For example, when onkeydown is pressed, the value of key is passed to the MyInterface method, print (String kename)
When using, implement this interface, for example, toast a bit
Another way is to create a new custom method, called in onkeydown, which can be replicated in subclasses of the custom control to achieve a custom implementation of the subclass
When using a custom control, you need the full package name + class name, if inside you need the $ symbol
Events for Android custom controls