我开发了一个注册屏幕,但是当我添加Manager.vertical_scrollbar
时它没有滚动。我想让_header位图静态,然后在_secondHeader之后滚动。我已将标题设为HorizontalFieldManager
,并将其添加到mainmanager1
,但仍然无效。我尝试了另一种解决方案 - 将其添加为setBanner,但在这种情况下,我无法添加字段_cancelbutton
和_signupButton
。
package mypackage;
import mypackage.BitmapButtonField;
import net.rim.device.api.system.Bitmap;
import net.rim.device.api.system.Display;
import net.rim.device.api.ui.Color;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.Manager;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.BasicEditField;
import net.rim.device.api.ui.component.BitmapField;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.container.VerticalFieldManager;
public class signupScreen extends MainScreen
{
private VerticalFieldManager mainManager1;
private int deviceWidth = Display.getWidth();
private int deviceHeight = Display.getHeight();
private Bitmap _backgroundBitmap = Bitmap.getBitmapResource
("background.png");
private BitmapField _HeaderBitmap =new BitmapField( Bitmap.getBitmapResource
("headerImg.png"));
private BitmapField _cancelbutton =new BitmapField( Bitmap.getBitmapResource
("cancel-blue-btn.png"));
private BitmapField _signupbutton =new BitmapField( Bitmap.getBitmapResource
("sign-up-btn.png"));
/* private Bitmap _HeaderBitmap =Bitmap.getBitmapResource
("headerImg.png"); */
//BitmapButtonField _signupbutton=new BitmapButtonField(Bitmap.getBitmapResource("sign-up-btn.png"),Bitmap.getBitmapResource("sign-up-btn.png"),Bitmap.getBitmapResource("sign-up-btn.png"));
private Bitmap _secondHeaderBitmap =(Bitmap.getBitmapResource
("running.png"));
RoundBorderTextBoxField Fnameobj=new RoundBorderTextBoxField(170,35,RoundBorderTextBoxField.USE_ALL_WIDTH);
RoundBorderTextBoxField Lnameobj=new RoundBorderTextBoxField(170,35,RoundBorderTextBoxField.USE_ALL_WIDTH);
RoundBorderTextBoxField email=new RoundBorderTextBoxField(170,35,RoundBorderTextBoxField.USE_ALL_WIDTH);
RoundBorderTextBoxField Unameobj=new RoundBorderTextBoxField(170,35,RoundBorderTextBoxField.USE_ALL_WIDTH);
RoundBorderTextBoxField pwdobj=new RoundBorderTextBoxField(170,35,RoundBorderTextBoxField.USE_ALL_WIDTH);
RoundBorderTextBoxField confrmpwdobj=new RoundBorderTextBoxField(170,35,RoundBorderTextBoxField.USE_ALL_WIDTH);
// RoundBorderTextBoxField phoneobj=new RoundBorderTextBoxField(195,40,RoundBorderTextBoxField.USE_ALL_WIDTH);
// RoundBorderTextBoxField Birthobj=new RoundBorderTextBoxField(195,40,RoundBorderTextBoxField.USE_ALL_WIDTH);
//
public signupScreen()
{
super(MainScreen.VERTICAL_SCROLL | MainScreen.VERTICAL_SCROLLBAR);
VerticalFieldManager mainManager=new VerticalFieldManager( VerticalFieldManager.FIELD_VCENTER)
{
public void paint(Graphics graphics)
{
graphics.clear();
graphics.drawBitmap(0, 0, deviceWidth,
deviceHeight, _backgroundBitmap, 0, 0);
super.paint(graphics);
}
};
//setBanner(_HeaderBitmap);
mainManager1= new VerticalFieldManager( Manager.FIELD_VCENTER |
Manager.FIELD_HCENTER)
{
protected void sublayout(int maxWidth, int maxHeight)
{
// int displayWidth = deviceWidth;
// int displayHeight = deviceHeight;
// super.sublayout( displayWidth, displayHeight);
// setExtent( displayWidth, displayHeight);
super.sublayout( 360,480);
setExtent( 360,480);
Field field = getField(0);
layoutChild(field, 360, 50);
setPositionChild(field, 0,0);
field = getField(1);
layoutChild(field, 100, 40);
setPositionChild(field, 8, 5);
field = getField(2);
layoutChild(field, 100, 40);
setPositionChild(field, 255, 5);
field = getField(3);
layoutChild(field,340, 160);
setPositionChild(field, 175,130);
field = getField(4);
layoutChild(field,340, 210);
setPositionChild(field, 175,175);
field = getField(5);
layoutChild(field,340, 260);
setPositionChild(field, 175,225);
field = getField(6);
layoutChild(field,340, 310);
setPositionChild(field,175,270);
field = getField(7);
layoutChild(field,340, 360);
setPositionChild(field, 175,315);
field = getField(8);
layoutChild(field,340, 410);
setPositionChild(field, 175,360);
/* field = getField(9);
layoutChild(field,340, 460);
setPositionChild(field, 175,405);*/
}
public void paint(Graphics graphics)
{
/*graphics.drawBitmap(0, 0, deviceWidth,
deviceHeight, _HeaderBitmap, 0,0); */
graphics.drawBitmap(10, 60, deviceWidth,
deviceHeight, _secondHeaderBitmap, 0,0);
super.paintChild(graphics, _HeaderBitmap);
super.paintChild(graphics, _cancelbutton);
super.paintChild(graphics, _signupbutton);
graphics.drawText("First Name", 35, 140, 0);
graphics.drawText("Last Name",35, 185, 0);
graphics.drawText("Email", 75, 230, 0);
graphics.drawText("Username", 40, 275, 0);
graphics.drawText("Password", 48, 320, 0);
graphics.drawText("Confirm Password", 17, 365, 0);
graphics.drawText("Phone", 90, 410, 0);
graphics.drawText("Gender", 80, 455, 0);
super.paintChild(graphics, Fnameobj);
super.paintChild(graphics, Lnameobj);
super.paintChild(graphics, email);
super.paintChild(graphics, Unameobj);
super.paintChild(graphics, pwdobj);
super.paintChild(graphics, confrmpwdobj);
// super.paintChild(graphics, phoneobj);
// super.paintChild(graphics, Birthobj);
//
}
};
mainManager1.add(_HeaderBitmap);
mainManager1.add(_cancelbutton);
mainManager1.add(_signupbutton);
mainManager1.add(Fnameobj);
mainManager1.add(Lnameobj);
mainManager1.add(email);
mainManager1.add(Unameobj);
mainManager1.add(pwdobj);
mainManager1.add(confrmpwdobj);
//mainManager1.add(phoneobj);
mainManager.add(mainManager1);
this.add(mainManager);
}
/* public Font derive(int style,
int height,
int units)*/
}