【发布时间】:2019-02-21 17:35:42
【问题描述】:
我是 Angular 的 NativeScript 新手,我想在操作栏中制作一个通知图标。下面是我想要的图标位置和外观。
通过学习以下操场项目中的示例,我已成功获得相同的位置。
但我的输出是这样的:
那里没有显示钟形字体图标。我使用矩形背景颜色突出显示了它的位置,因此很容易理解我想要这个图标的位置。另一个点标签显示在正确的位置。但我无法在点图标之前显示我的通知铃图标。下面是我的代码,请告诉我我在代码中做错了什么以及如何在点标签之前设置通知铃图标。
dashboard.component.html
<ActionBar class="action-bar" flat="true">
<!--
Use the NavigationButton as a side-drawer button in Android
because ActionItems are shown on the right side of the ActionBar
-->
<NavigationButton ios:visibility="collapsed" icon="res://menu" (tap)="onDrawerButtonTap()"></NavigationButton>
<!--
Use the ActionItem for IOS with position set to left. Using the
NavigationButton as a side-drawer button in iOS is not possible,
because its function is to always navigate back in the application.
-->
<ActionItem icon="res://navigation/menu" android:visibility="collapsed" (tap)="onDrawerButtonTap()"
ios.position="left">
</ActionItem>
<GridLayout width="100%" rows="auto" columns="*,50,auto">
<Label col="0" row="0" class="action-bar-title" text="Dashboard"></Label>
<StackLayout col="1" row="0" rowSpan="2" class="ah-notification" backgroundColor="#44557f">
<Label text="" class="fa ah-bell"></Label>
</StackLayout>
<Label col="1" row="0" text="" class="fa ah-dot"></Label>
<!-- <Image col="1" row="0" horizontalAlignment="right" marginRight="10" class="status-img" src="res://chat"></Image> -->
<Image col="2" row="0" horizontalAlignment="right" marginRight="10" class="status-profile" src="res://chat"></Image>
</GridLayout>
</ActionBar>
<GridLayout class="page page-content">
<Label class="page-icon fa" text=""></Label>
<Label class="page-placeholder" text="<!-- Page content goes here -->"></Label>
</GridLayout>
dashboard.component.scss
.ah-notification {
width: 30;
height: 30;
.ah-bell {
width: 30;
height: 30;
border-radius: 6;
stretch: aspectFill;
font-size: 15px;
// margin-top: -10;
}
}
.ah-dot {
width: 12;
height: 12;
background-color: #49494b;
border-width: 2;
border-radius: 25;
border-color: #49494b;
vertical-align: top;
horizontal-align: center;
margin-top: 43;
z-index: 21 // margin-left: -50;
}
【问题讨论】:
标签: nativescript angular2-nativescript