代号一:模拟器和真实的Android设备上的用户界面布局完全不同 [英] Codename One: User interface layout on simulator and a real Android device are complete different

查看:158
本文介绍了代号一:模拟器和真实的Android设备上的用户界面布局完全不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,这是我第一次在真实的Android设备上测试我的应用。用户界面布局与模拟器有着惊人的不同。请查看图片:

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版本是5.1.1。

Android version is 5.1.1.

显示屏幕的代码是:

    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?

我至少希望将徽标放置在Android设备的中央。我该怎么做?

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

推荐答案

您正在使用本机主题,如果安装了Android外观,您将看到该主题因为这是故意的,所以在模拟器上也是如此。

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.

您的主题和代码可以覆盖特定于平台的行为以产生相同的结果,例如覆盖标签的位置等。即使标签位于底部,该应用也不会像Android上一样原生。

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.

这篇关于代号一:模拟器和真实的Android设备上的用户界面布局完全不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆