I have custom Android keyboard:
public class CustomKeyboard extends Keyboard{...}
public class CustomKeyboardView extends KeyboardView{...}
p
You can use PopupWindow
class and populate it with custom layout.
View custom = LayoutInflater.from(context)
.inflate(R.layout.your_layout, new FrameLayout(context));
PopupWindow popup = new PopupWindow(context);
popup.setContentView(custom);
and on long press
//Get x,y based on the touch position
//Get width, height based on your layout
if(popup.isShowing()){
popup.update(x, y, width, height);
} else {
popup.setWidth(width);
popup.setHeight(height);
popup.showAtLocation(yourKeyboardView, Gravity.NO_GRAVITY, x, y);
}
On click in the popup you can dismiss it
popup.dismiss();