0

嗨,我有带有背景图像的弹出屏幕。图像显示为黑色边框。那么我怎样才能删除弹出屏幕的额外黑色?

4

5 回答 5

2

试试上面@Mugur 给出的代码,但你仍然会得到弹出屏幕的起伏边框。要删除边框,请使用以下代码

Border border = BorderFactory.createSimpleBorder( new XYEdges(), Border.STYLE_TRANSPARENT);
            this.setBorder(border);
于 2012-05-09T08:54:22.533 回答
1

尝试这个...

  // Clear the default translucent background

  PopupWindow popup = new PopupWindow(context);
  popupWindow.setBackgroundDrawable(new BitmapDrawable());

或者试试这个...

  popupWindow.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
于 2014-02-13T07:09:02.023 回答
0

You need to override applyTheme and make it do nothing, to avoid the black border on a popup:

protected void applyTheme(){}
于 2011-03-29T00:41:31.367 回答
0

尝试这个:

PopupScreen scr = new PopupScreen() {
   protected void paintBackground(Graphics g) {
      int color = 0xff0000;
      g.setColor(color);
      g.fillRect(0, 0, Display.getWidth(), Display.getHeight());
   }
}

这应该将背景颜色设置为红色(ff0000)。


编辑:

PopupScreen scr = new PopupScreen(new VerticalFieldManager() {
       protected void paint(Graphics g) {
          int color = g.getColor();
          g.setColor(0xff0000);
          g.fillRect(0, 0, Display.getWidth(), Display.getHeight());
          g.setColor(color);
          super.paint(g);
       }
});
于 2011-03-28T07:04:15.623 回答
0

尝试创建自己的自定义弹出屏幕并覆盖方法您可以使用paint方法创建自己的自定义背景

尝试反复试验它肯定会以这种方式工作

要创建自定义弹出屏幕,您需要做的就是创建一个类,然后扩展 popScreen

于 2011-03-28T12:23:26.187 回答