Pav*_*ati 1 css android-toast ionic-framework ionic2
我们正在创建 Ionic-Native 移动应用程序。我们正在使用 ToastController ( ToastController )。我们使用position: 'top'。但它与状态栏重叠。所以我们想要自定义位置。我们试过这样
let Errortoast = this.toastCtrl.create({
message: 'Please try again later',
duration: 3000,
cssClass: 'toast',
position: 'top'
});
.toast{
margin-top: 70px;
}
Run Code Online (Sandbox Code Playgroud)
但没有运气。自定义位置的任何想法?。
您可以将其transform: translateY(70px);用作 CSS 属性来Toast向下移动。
这是一个完整的代码示例:
你的页面.ts
this.toastCtrl.create({
message: 'Please try again later',
duration: 3000,
cssClass: 'yourClass',
position: 'top'
}).present();
Run Code Online (Sandbox Code Playgroud)
你的页面.css
.yourClass {
.toast-wrapper {
transform: translateY(70px) !important;
}
}
Run Code Online (Sandbox Code Playgroud)
注意:这个 CSS 代码片段需要在pageCSS.toast-wrapper之外,因为它在页面之外。