2011-03-28 50 views

回答

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); 
     } 
}); 
+0

thax Mugur。這段代碼不能幫助我..如果你有另一種解決辦法比PLZ幫助我。 – 2011-03-28 07:26:50

+1

我使用setBackground(BackgroundFactory.createSolidTransparentBackground(Color.WHITE,0));但我仍然得到一點黑色邊框。 – 2011-03-28 09:19:06

+0

嘗試新想法,請致電 – Mugur 2011-03-28 12:10:06

0

嘗試創建自己的自定義popscreen和使用paint方法

試試驗覆蓋 您可以創建自己的自定義背景的方法和錯誤時一定會以這種方式工作

要創建自定義彈出窗口,您只需創建一個類,然後將popScreen擴展爲

0

你需要重寫applyTheme並使其什麼也不做,以避免在彈出窗口中的黑色邊框:

protected void applyTheme(){} 
2

嘗試通過@Mugur給上面的代碼,但你仍然將結束的沉浮邊界彈出屏幕。要刪除邊框使用下面的代碼

Border border = BorderFactory.createSimpleBorder(new XYEdges(), Border.STYLE_TRANSPARENT); 
      this.setBorder(border); 
+0

感謝此代碼工作.......... – 2012-08-24 06:02:29

+0

這是什麼?真的android? – suitianshi 2014-02-26 02:36:40

1

嘗試......

// Clear the default translucent background 

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

或者試試這個...

popupWindow.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); 
+0

這是BlackBerry Java? – 2014-02-14 21:48:47