首页 文章

ng如果不使用自定义NativeScript Angular ActionBar

提问于
浏览
1

出于某些疯狂的原因,我无法在ActionBar上或在ActionBar中工作 .

我假设这个问题是由我的自定义ActionBar设置 ActionBar.titleView 引起的 . 但是,根据我目前的理解,我设置了这种方式,以便为 Headers 设置自定义字体 .

我把它设置如下..

<RadSideDrawer #drawer>
    <StackLayout tkDrawerContent class="sideStackLayout">
        <StackLayout class="sideTitleStackLayout">
            <Label [text]="name"></Label>
        </StackLayout>
        <StackLayout class="sideStackLayout">
            <Label text="Dashboard" class="sideLabel sideLightGrayLabel"></Label>
            <Label text="Sessions" class="sideLabel"></Label>
            <Label text="Starred" class="sideLabel"></Label>
        </StackLayout>
    </StackLayout>

    <StackLayout tkMainContent>

        <ActionBar>
            <ActionBar.titleView>
                <Label text="Dashboard"></Label>
            </ActionBar.titleView>

            <ActionItem 
                *ngIf="!gameOn"
                id="startsessbtn" 
                (tap)="startSession()" 
                text="start"
                ios.systemIcon="4" 
                ios.position="right"
                android.systemIcon="ic_menu_add" 
                android.position="actionBar">
            </ActionItem>

            <ActionItem 
                *ngIf="gameOn"
                id="startsessbtn" 
                (tap)="endSession()" 
                text="end"
                ios.systemIcon="4" 
                ios.position="right"
                android.systemIcon="ic_menu_edit" 
                android.position="actionBar">
            </ActionItem>

        </ActionBar>


        <StackLayout>....</StackLayout>


    </StackLayout>
</RadSideDrawer>

我想要做的是在这种情况下显示一个ActionItem取决于布尔值 gameOn 但这只是不起作用 .

1 回答

  • 2
    • 将ActionBar放在RadSideDrawer上方,例如:
    <ActionBar>
      // etc.
    </ActionBar>
    <RadSideDrawer #drawer>
      // etc.
    

    NativeScript Angular中不存在

    • ActionBar.titleView,因此您需要将此设置用于自定义 Headers :
    <ActionBar>
      <StackLayout horizontalAlignment="center" verticalAlignment="center">
        <Label text="Dashboard"></Label>
      </StackLayout>
      <ActionItem *ngIf="!gameOn">
        // etc.
      </ActionItem>
    </ActionBar>
    

相关问题