Codename One: User interface layout on simulator and a real Android device are complete different

你。 提交于 2019-12-08 08:17:07

问题


Well, it is the first time I tested my app on a real Android device. The user interface layout is shockingly different from the simulator. Please see images:

The code are the same and nothing had been modified.

Android version is 5.1.1.

The code to display the screen is:

    private final void show() {
    loginSignupForm = new Form(null, new BorderLayout());
    Tabs loginSignupTabs = new Tabs();
    Image splashScreenImage = theme.getImage("Starlent_logo25x25.png");
    ((Label) loginSignupForm.getToolbar().getTitleComponent()).setIcon(splashScreenImage);
    Style loginSignupStyle = UIManager.getInstance().getComponentStyle("Tab");
    prepareAndAddSignupTab(loginSignupTabs, loginSignupStyle);
    prepareAndAddLoginTab(loginSignupTabs, loginSignupStyle);
    loginSignupForm.add(BorderLayout.CENTER, loginSignupTabs);
    loginSignupForm.show();
}

So, how do I manage or expect the layout to be in different devices?

At the very least, I hope to have the logo placed in the center of the Android device. How do I do that?


回答1:


You are using the native theme, if you install an Android skin you will see that the theme behaves that way on the simulator too as this is intentional.

Your theme and code can override platform specific behavior to produce identical results e.g. override tab placement etc. The app won't feel as native on Android though if the tabs are on the bottom.



来源:https://stackoverflow.com/questions/42887456/codename-one-user-interface-layout-on-simulator-and-a-real-android-device-are-c

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