Custom Pop up with no Black background in blackberry

若如初见. 提交于 2019-12-23 02:52:38

问题


I want to remove the black background in Popup field i know we use applyTheme method in blackberry to subdue its effect but dunno how to use it I want to remove the black background and use an image instead .

I have tried this method

protected void applyTheme(Graphics arg0, boolean arg1) {
    // TODO Auto-generated method stub
    super.applyTheme(arg0, arg1);
}

回答1:


public class CustomDialogBox extends PopupScreen {

    Bitmap mDialogImg=null;
    public CustomDialogBox(Bitmap dialogImg) {
        super(new VerticalFieldManager(),Field.FOCUSABLE);
        this.mDialogImg=dialogImg;
        VerticalFieldManager vfm=new VerticalFieldManager() {
            protected void paint(Graphics graphics) {

                graphics.drawBitmap(0, 0, mDialogImg.getWidth(), mDialogImg.getHeight(), mDialogImg, 0, 0);
            };

            protected void sublayout(int maxWidth, int maxHeight) {

                super.sublayout(mDialogImg.getWidth(), mDialogImg.getHeight());
                super.setExtent(mDialogImg.getWidth(), mDialogImg.getHeight());
            }
        };

        add(vfm);
    }

    protected void applyTheme() {
    }

}

I tried the following program and it works perfectly fine i added a Bitmap image to a vertical field manager and then using the method

applyTheme() as follows

protected void applyTheme() {
}

i do get the required results



来源:https://stackoverflow.com/questions/13563352/custom-pop-up-with-no-black-background-in-blackberry

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!