Blackberry App Appearance VS Facebook App

江枫思渺然 提交于 2019-12-13 03:33:03

问题


I am using the built in field manager from RIM. (SDK 7.0)

Yet the effects are shocking. The layout is dreadful, and Ive no idea how to customise it. You can see the difference to my app against facebook app. Did they use the built in stuff, if so how? and if not how do I do similar?

How would I go about making my forms look so much better. Ive tried modifying the Styles parameter in many ways.

Current code:

    final BasicEditField UserID = new BasicEditField( "User ID:", "example");
    final BasicEditField UserName = new BasicEditField( "Username:", "");
    final BasicEditField Password = new PasswordEditField( "Password:", "example" );

    VerticalFieldManager loginFields = new VerticalFieldManager(FIELD_HCENTER |FIELD_VCENTER );
    loginFields.add( UserID ); 
    loginFields.add( UserName ); 
    loginFields.add( Password ); 

    ButtonField Login = new ButtonField( "Login", ButtonField.CONSUME_CLICK | ButtonField.FIELD_HCENTER );
    loginFields.add( Login );

回答1:


you can use the following code as starting point to create a fancy login screen:

public loginScreen() {

    super(MainScreen.VERTICAL_SCROLL | MainScreen.VERTICAL_SCROLLBAR);

    vMgr = (VerticalFieldManager)getMainManager();

    XYEdges mgrThickPadding = new XYEdges(4, 4, 4, 4);
    Border mgrRoundedBorder = BorderFactory.createRoundedBorder(mgrThickPadding, Border.STYLE_SOLID);
    Background bg = BackgroundFactory.createSolidBackground(Color.LIGHTSTEELBLUE);
    vMgr.setBackground(bg);
    vMgr.setBorder(mgrRoundedBorder);

    setTitle("Login Screen");

    XYEdges thickPadding = new XYEdges(4, 4, 4, 4);
    Border roundedBorder = BorderFactory.createRoundedBorder(thickPadding, Border.STYLE_SOLID);

    Background solidBackground = BackgroundFactory.createSolidBackground(Color.LIGHTGRAY);
    this.setBackground(solidBackground);


    usernameFld = new EditField("Username: ","", 20, BasicEditField.NO_NEWLINE);
    usernameFld.setBorder(roundedBorder);
    usernameFld.setBackground(solidBackground);

    passwordFld = new PasswordEditField("Password: ","", 20, 0); 
    passwordFld.setBorder(roundedBorder);
    passwordFld.setBackground(solidBackground);

    FieldChangeListener listener = new FieldChangeListener() {

        public void fieldChanged(Field field, int context) {
            ButtonField buttonField = (ButtonField) field;
            System.out.println("Button pressed: " + buttonField.getLabel());

            if (field == loginBtn)
            {
                // Do Login actions
            }
        }
    };

    loginBtn.setMinimalWidth(200);
    loginBtn.setChangeListener(listener);

    vMgr.add(usernameFld);
    vMgr.add(passwordFld);           
    vMgr.add(loginBtn);
}



回答2:


You should use custom components create UI like this. Also you can use setBorder and setBackgound properties of field.

This SO link gives moe details about Blackberry User Interface Design. it Should help you.



来源:https://stackoverflow.com/questions/9688140/blackberry-app-appearance-vs-facebook-app

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