在我的应用程序中使用自定义PopupWindow在哪里使用
popup.setBackgroundDrawable(new BitmapDrawable());
Run Code Online (Sandbox Code Playgroud)
方法.现在它已被弃用,如果没有这种方法,我就无法为弹出窗口提供背景信息.我从文章中读到它的替代方案
popup.setsetBackgroundDrawable(new BitmapDrawable(Context.Resources,Drawable);
Run Code Online (Sandbox Code Playgroud)
但在这里我没有使用任何drawable我的popUp.我的代码在下面给出了我自定义Popupwindow的位置,这里是为了解决这个问题.
@Override
public void onWindowFocusChanged(boolean hasFocus) {
int[] location = new int[2];
Button button = (Button) findViewById(R.id.VBG_img_pin_x);
// Get the x, y location and store it in the location[] array
// location[0] = x, location[1] = y.
button.getLocationOnScreen(location);
// Initialize the Point with x, and y positions
p = new Point();
p.x = location[0];
p.y = location[1];
}
// The method that displays the popup.
private void showPopup(final Activity context, Point p) {
// …Run Code Online (Sandbox Code Playgroud)