I am working on an application in which I am in a need to implement Android Facebook like slider in BB for O.S version 5.0, 6.0 and 7.0.
I have search but didn't got anything useful. Can anyone suggest me the right way to implement this.?
I am working on an application in which I am in a need to implement Android Facebook like slider in BB for O.S version 5.0, 6.0 and 7.0.
I have search but didn't got anything useful. Can anyone suggest me the right way to implement this.?
它只是一个逻辑。你必须以你的方式定制它
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);
}
参考这篇文章