我们在黑莓手机中看到的Facebook Slider?

时间:2013-09-05 05:51:55

标签: blackberry

我正在开发一个应用程序,我需要在BB中为O.S版本5.0,6.0和7.0实现类似Android的Android Facebook。

我有搜索但没有任何有用的东西。任何人都可以建议我采用正确的方法实现这一目标。

enter image description here

1 个答案:

答案 0 :(得分:2)

只是一个逻辑。你必须以自己的方式自定义

boolean val=false;

public MyScreen()
{       

    final ButtonField l=new ButtonField("menu");


    final HorizontalFieldManager hfm_main=new HorizontalFieldManager();

    final VerticalFieldManager vfm_l=new VerticalFieldManager(){
         protected void sublayout(int maxWidth, int maxHeight) {
                super.sublayout(280, maxHeight);
                setExtent(280, maxHeight);
            }
         protected void paint(Graphics g){
                g.setBackgroundColor(Color.RED);
                // Clears the entire graphic area to the current background
                g.clear();
                super.paint(g);
            }
    };
    final VerticalFieldManager vfm_r=new VerticalFieldManager(){
         protected void sublayout(int maxWidth, int maxHeight) {
             super.sublayout(maxWidth+300, maxHeight);
             setExtent(maxWidth, maxHeight);
         }
         protected void paint(Graphics g){
             g.setBackgroundColor(Color.YELLOW);
             // Clears the entire graphic area to the current background
             g.clear();
             super.paint(g);
         }
    };

    vfm_l.add(new LabelField("sliding pannel"));

    vfm_r.add(l);
    vfm_r.add(new LabelField("main view"));

    hfm_main.add(vfm_r);

    add(hfm_main);

 FieldChangeListener listener=new FieldChangeListener() {

        public void fieldChanged(Field field, int context) {
            if(field==l){
                if(!val){
                    val=true;
                    hfm_main.deleteAll();
                    hfm_main.add(vfm_l);
                    hfm_main.add(vfm_r);
                    hfm_main.invalidate();

            }else{
                val=false;
                hfm_main.deleteAll();
                hfm_main.add(vfm_r);
                hfm_main.invalidate();

            }
            }
        }
    };
    l.setChangeListener(listener);

}

参考to this post