0

在我的应用程序中有一个。此MainScreen屏幕包含许多字段管理器,Vertical并且Horizontal所有内容都通过滚动成功显示。

这是我的主要VerticalFieldmanager代码。

vfm_Main = new VerticalFieldManager()
    {
            public void paint(Graphics g)
            {
                g.setColor(Color.WHITE);
                g.drawBitmap(0,0,mybackgroundImage.getWidth(),mybackgroundImage.getHeight(),mybackgroundImage,0,0);
                                    super.paint(g);
            }
            protected void sublayout(int maxWidth, int maxHeight) 
            {
                super.sublayout(Display.getWidth(),Display.getHeight());
                setExtent(Display.getWidth(),Display.getHeight());
            }
    };

此屏幕有一个背景图像绘制。当我滚动此屏幕以查看此屏幕的全部内容时,我的背景图像也会随着内容滚动。因此,背景图像看起来很模糊,并且在屏幕底部重复出现。

我只想滚动该屏幕的内容。那么如何实现这个..?

我尝试了很多,但没有得到任何建议和打击来防止这种情况发生?如果有人遇到这个问题或有任何想法,请帮助我...

提前致谢 !!!

4

2 回答 2

1

你必须这样做:

vfm_Main = new VerticalFieldManager()
{
            public void paint(Graphics g)
            {
                g.setColor(Color.WHITE);
                g.drawBitmap(0,0,mybackgroundImage.getWidth(),mybackgroundImage.getHeight(),mybackgroundImage,0,0);
                super.paint(g);
            }
            protected void sublayout(int maxWidth, int maxHeight) 
            {
                    super.sublayout(Display.getWidth(),Display.getHeight());
                    setExtent(Display.getWidth(),Display.getHeight());
            }
};

subver=new VerticalFieldManager(VERTICAL_SCROLL|VERTICAL_SCROLLBAR)
{
        protected void sublayout(int maxWidth, int maxHeight) 
        {
                 super.sublayout(Display.getWidth(),Display.getHeight()-3);//here we scroll the inner vertical
                 setExtent(Display.getWidth(),Display.getHeight()-3);
        }
 }
 //Write all the code here;
 subver.setpadding(1,0,0,0);
 vfm_main.add(subver);
 add(vfm_Main);

喜欢这张图片:

垂直滚动

足够的;

于 2011-11-17T11:15:57.093 回答
0

我也遇到过同样的问题。我通过使用像这样的 2 个现场管理器来修复它。

VerticalFieldManager mainManager = new VerticalFieldManager(Manager.NO_VERTICAL_SCROLL | Manager.NO_VERTICAL_SCROLLBAR )
    {

        public void paint(Graphics graphics)
        {
            graphics.clear();
            graphics.drawBitmap(0, 0, Display.getWidth(), Display.getHeight(), backgroundBitmap, 0, 0);                       
            super.paint(graphics);
        }            
    };
  //this manager is used for adding the componentes
    VerticalFieldManager subManager = new VerticalFieldManager(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR )
    {
        protected void sublayout( int maxWidth, int maxHeight )
        {
            int displayWidth = Display.getWidth();
            int displayHeight = Display.getHeight();

            super.sublayout( displayWidth, displayHeight);
            setExtent( displayWidth, displayHeight);
        }
    };
于 2011-11-18T12:48:57.297 回答