nativescript - 带有 Nativescript 的滚动视图中的多个全屏
问题描述
我想知道如何在带有 nativescript 的滚动视图中拥有多个全屏?
我试过这个:
<Page actionBarHidden="true" class="page">
<ScrollView orientation="vertical">
<StackLayout>
<StackLayout height="100%" backgroundColor="red">
<Label text="Fullscreen 1"></Label>
</StackLayout>
<StackLayout height="100%" backgroundColor="blue">
<Label text="Fullscreen 2"></Label>
</StackLayout>
</StackLayout>
</ScrollView>
</Page>
但是堆栈不是全屏的。
解决方案
我修复了这个:
模板
<Page actionBarHidden="true">
<ScrollView orientation="vertical">
<StackLayout>
<StackLayout :height="screenHeight" backgroundColor="red">
...
</StackLayout>
<StackLayout :height="screenHeight" backgroundColor="blue">
...
</StackLayout>
</StackLayout>
</ScrollView>
</Page>
并添加:
import { screen } from "tns-core-modules/platform";
...
data() {
return {
screenHeight: 0
};
},
...
created() {
this.screenHeight = screen.mainScreen.heightDIPs
}
推荐阅读
- lotus-notes - 如何在多米诺骨牌设计器中修复类未发现异常?
- jquery - Dropdown-menu should collapse on LINK click
- sapui5 - 如何在不重新打开的情况下获得 sapui5 应用程序的初始状态
- delphi - TSendMail.Execute 返回 True 而不发送
- javascript - module.exports 未在 Node.js 中返回结果
- biginteger - BigInteger 方法 bitLength() 在应用于 BigInteger "-4" 时如何返回 2?
- r - 为什么在比较 8 个皇后问题的 if 语句中的数组元素时出现“参数长度为 0”错误
- android-layout - ViewBinding - 如何在 ViewBinding 中设置包含布局的可见性?
- zk - 如何在 ZK 日历中禁用过去的日子?
- python - 如何计算 pytorch 中关键点检测 CNN 模型的准确度?