【问题标题】:nativescript actionbar under status bar in androidandroid中状态栏下的nativescript操作栏
【发布时间】:2017-05-12 16:31:36
【问题描述】:

我从 Nativescript (javascript) 开始,我在 android 中的操作栏有问题。 当我按如下方式创建操作栏时:

    <Page xmlns="http://schemas.nativescript.org/tns.xsd">
      <Page.actionBar>
          <ActionBar title="My ActionBar"/>
      </Page.actionBar>

      <!-- page content ... -->
    </Page>

在手机的状态栏下创建了action bar(没有做过css):

Action bar under the status bar

1) 我是否遗漏了什么或者这是正常行为?

2) 操作栏的大小也比所有其他应用程序大得多。默认高度是否大于标准?

谢谢

【问题讨论】:

    标签: android-actionbar nativescript


    【解决方案1】:

    页面有一个名为backgroundSpanUnderStatusBar的属性来控制内容是否可以跨越状态栏。

    默认大小应该是标准的。不过,您可以为您的操作栏创建 custom layout 或使用 CSS theme

    【讨论】:

    • 设置 backgroundSpanUnderStatusBar = "false" 并不能解决问题。查看一些示例 (github.com/NativeScript/nativescript-marketplace-demo) 我看到在 app.android.css 中有 ActionBar { margin: 25 0 0 0;没有这个,它会像我的情况一样在状态栏下。我开始认为这是默认行为。
    • 您在哪个 API 级别遇到此行为 - 我制作了一个基本项目,但无法重现,并且在状态栏后正常呈现操作栏(API 23+) 这是项目:github.com/NickIliev/NativeScript-issues/tree/master/stack/…
    • 请记住,如果您使用市场演示作为项目模板,则可能会导致您的操作栏位于状态栏下方,因为那里专门使用了全屏启动屏幕模板。但是,如果您使用其中一个基本模板创建新应用程序,您的操作栏将不会进入
    • 您的项目运行良好。我在哪里可以查看 API 级别?非常感谢
    • 我的意思是您的测试设备(模拟器或真实设备)的 API 级别。但是这更可能是另一个原因,因为我已经确认使用默认模板,所有内容也适用于旧 API 级别
    猜你喜欢
    • 2020-06-25
    • 2016-12-21
    • 2016-01-27
    • 2021-02-20
    • 2020-01-09
    • 1970-01-01
    • 1970-01-01
    • 2017-02-10
    • 1970-01-01
    相关资源
    最近更新 更多