2017-02-24 34 views
0

我需要在屏幕底部有一個按鈕,但只要我點擊文本框,鍵盤就會顯示並提起按鈕。我試着用一個按鈕,另一個stacklayout,一個scrollview包裝它...沒有任何工作,我覺得我不正確理解佈局。鍵盤提升底部按鈕

它是灰色的按鈕 - >I want the gray button there

但它總是用鍵盤來了,see?

這是我的理解,這應該是一個滾動視圖以使其保持在它的底部位置,但如果我添加一個ScrollView到gridLayout,所以它滾動,它不起作用。

這是代碼。先謝謝你。

<ActionBar android:title="Entrega {{id}}/{{detalleRuta.delegacion}}/{{detalleRuta.tipoAlbaran}}"> 
    <ActionItem> 
     <Label *ngIf="!entrega.foto" cssClass="mdi icon-cam" [text]="'mdi-add-a-photo' | fonticon" ios.position="right" (tap)="getFoto()"></Label> 
     <Label *ngIf="entrega.foto" cssClass="mdi icon-cam" [text]="'mdi-photo' | fonticon" ios.position="right" (tap)="showFoto()"></Label> 
    </ActionItem> 
    <ActionItem> 
     <Label class="mdi icon-map" [text]="'mdi-event-busy' | fonticon" ios.position="right" (tap)="cancelarEntrega()"></Label> 
    </ActionItem> 
</ActionBar> 
<GridLayout rows="auto,*, 50" loaded="pageLoaded"> 
    <ListView row="0" [items]="detalle"> 
     <template let-item="item"> 
      <StackLayout orientation="vertical" class="info-entrega"> 
       <Label *ngIf="item.fechaActual" [text]="'Fecha ' + item.fechaActual"></Label> 
       <Label *ngIf="item.horaActual" [text]="'Hora ' + item.horaActual"></Label> 
      </StackLayout> 
     </template> 
    </ListView> 
    <TabView row="1" selectedIndex="0" selectedColor="#00B4E6" *ngIf="!noEntregado"> 
     <StackLayout *tabItem="{title: 'Cliente'}"> 
     <ScrollView> 
      <StackLayout class="formulario"> 
       <TextField [(ngModel)]="entrega.nombreCliente" hint="Nombre Cliente" keyboardType="text" autocorrect="false" autocapitalizationType="none"></TextField> 
       <TextField [(ngModel)]="entrega.DNICliente" hint="DNI Cliente" keyboardType="text" autocorrect="false" autocapitalizationType="none"></TextField> 
       <TextField [(ngModel)]="entrega.emailCliente" hint="Email Cliente" keyboardType="email" autocorrect="false" autocapitalizationType="none"></TextField> 
       <Button style="width:100%" class="btn {{ entrega.firmaCliente ? 'conFirma' : 'sinFirma' }}" text="Firma Cliente" (tap)="firmaCliente(false)"></Button> 
      </StackLayout> 
     </ScrollView> 
     </StackLayout> 
     <StackLayout *tabItem="{title: 'Empleado'}"> 
     <ScrollView> 
      <StackLayout class="form-config"> 
       <TextField class="input-config" [(ngModel)]="entrega.nombreEmpleado" hint="Nombre Empleado" keyboardType="text" autocorrect="false" autocapitalizationType="none"></TextField> 
       <TextField class="input-config" [(ngModel)]="entrega.DNIEmpleado" hint="Dni Empleado" keyboardType="text" autocorrect="false" autocapitalizationType="none"></TextField> 
       <Button style="width:100%" cssClass="btn {{ entrega.firmaEmpleado ? 'conFirma' : 'sinFirma' }}" text="Firma Empleado" (tap)="firmaEmpleado(false)"></Button> 
      </StackLayout> 
     </ScrollView> 
     </StackLayout> 
     <StackLayout *tabItem="{title: 'Importes'}"> 
     <ScrollView *ngIf="detalleRuta.importePdte != 0"> 
      <StackLayout class="form-config"> 
       <StackLayout> 
        <Label *ngIf="entrega.impMetalico" class="impMetalico" [text]="'Metálico ' + impMetalicoCurrency"></Label> 
        <TextField id="impMetalico" keyboardType="number" [(ngModel)]="entrega.impMetalico" hint="Importe en Metálico" (textChange)="cambioMetalico($event)"></TextField> 
       </StackLayout> 

       <StackLayout> 
        <Label *ngIf="entrega.impTarjeta" class="impTarjeta" [text]="'Tarjeta ' + impTarjetaCurrency"></Label> 
        <TextField id="impTarjeta" keyboardType="number" [(ngModel)]="entrega.impTarjeta" hint="Importe en Tarjeta" (textChange)="cambioTarjeta($event)"></TextField> 
       </StackLayout> 

       <StackLayout> 
        <Label *ngIf="entrega.impVale" class="impVale" [text]="'Vale ' + impValeCurrency"></Label> 
        <TextField id="impVale" keyboardType="number" [(ngModel)]="entrega.impVale" hint="Importe en Vale" (textChange)="cambioVale($event)"></TextField> 
       </StackLayout> 

       <StackLayout> 
        <Label *ngIf="entrega.impOtros" class="impOtros" [text]="'Otros ' + impOtrosCurrency"></Label> 
        <TextField id="impOtros" keyboardType="number" [(ngModel)]="entrega.impOtros" hint="Importe en Otros" (textChange)="cambioOtros($event)"></TextField> 
       </StackLayout> 

       <StackLayout> 
        <Label *ngIf="entrega.total" class="total" [text]="'Total ' + totalCurrency"></Label> 
       </StackLayout> 

       <StackLayout class="sumTotal"> 
        <Label *ngIf="sumTotal" class="total" [text]="'Total ' + sumTotal | myCurrency"></Label> 
       </StackLayout> 
      </StackLayout> 
     </ScrollView> 
     <StackLayout *ngIf="detalleRuta.importePdte == 0"> 
      <Label class="sinImporte" text="El importe Pendiente es de 0€"></Label> 
     </StackLayout> 
     </StackLayout> 
    </TabView> 
    <Button row="2" *ngIf="!noEntregado" class="btn" text="Confirmar Entrega" (tap)="submit()"></Button> 

    <StackLayout row="1" *ngIf="noEntregado"> 
    <ScrollView class="scrollView"> 
     <StackLayout class="form-config"> 
      <Label *ngIf="desc" class="desc" text="{{desc}}"></Label> 
      <Button style="width:100%" text="Motivo" (tap)="getMotivos()"></Button> 
      <StackLayout class="input-field"> 
       <TextView hint="Observación." returnKeyType="send" [(ngModel)]="entrega.obsNoEntrega" editable="true" class="input input-border"></TextView> 
      </StackLayout> 
      <Button class="btn" text="Cancelar Entrega" (tap)="cancel()"></Button> 
     </StackLayout> 
    </ScrollView> 
    </StackLayout> 
</GridLayout> 
<ActivityIndicator class="activity-indicator" width="100" [busy]="isLoading" height="100"></ActivityIndicator> 
+0

你可以嘗試移動''了'ScrollView'之外。你可以在'ScrollView'父'StackLayout'中移動它 –

回答

0

這是我如何管理我的鍵盤,而不是在文本框焦點時按下按鈕。

<StackLayout> 
<ScrollView > 
<CardView shadowColor="#FE00FC" elevation="20" id="container" row="1"> 
    <GridLayout rows="auto auto auto auto auto auto auto"> 
     <TextField row="1" hint="User Name" keyboardType="email" autocorrect="false" autocapitalizationType="none" returnKeyType="next" [(ngModel)]="user.name"></TextField> 
     <TextField row="2" hint="Password" id="pass" keyboardType="email" secure="true" [(ngModel)]="user.password"></TextField> 

     <Button row="3" text="Login" class="submit-button" (tap)="submit()"></Button> 
    </GridLayout> 
</CardView> 
</ScrollView> 
</StackLayout>