質問

I wrote a simple program that adds two edit fields to the field manager:

    HorizontalFieldManager hrfm = new HorizontalFieldManager(Manager.HORIZONTAL_SCROLL);        

    EditField editField1 = new EditField();           
    editField1.setText("User Name:");
    EditField editField2 = new EditField();
    editField2.setText("Hello");

    hrfm.add(editField1);
    hrfm.add(editField2); 
    add(hrfm);

But when i run the emulator it is displaying only UserName field only. I am unable to find the other edit field. Why is this problem occuring. I also faced the similar problem while adding checkbox, labelField. Please help me on using this FieldManager. Thank you

役に立ちましたか?

解決

Check How to - Implement advanced buttons, fields, and managers.

There is JustifiedHorizontalFieldManager - it should solve your need.

他のヒント

Hope this will helps you.

EditField editField1 = new EditField();           
editField1.setText("User Name:");
EditField editField2 = new EditField();
editField2.setText("Hello");
int Width = editField1.getPrefferedWidth()+editField2.getPrefferedWidth();
int Height = editField1.getPrefferedHeight()+editField2.getPrefferedHeight();
HorizontalFieldManager hrfm = new HorizontalFieldManager(Manager.HORIZONTAL_SCROLL)
{
   protected void sublayout(int maxWidth, int maxHeight) {
                super.sublayout(Width, Height);
                super.setExtent(Width, Height)
            }
}        
hrfm.add(editField1);
hrfm.add(editField2); 
add(hrfm);
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top