2015-11-27 43 views
0

我有這在index.xml文件中窗口有3視圖有第二視圖作爲窗體視圖與2文本框。在輕擊文本框時,它隱藏在虛擬鍵盤後面。我想在輸入文本框時獲得可滾動視圖。滾動窗體視圖上單擊文本框appcelerator

in index.js我打開窗口爲$ .win.open()和$ .win1.open()。

<Alloy> 
<View id="network" class="network" width= Titanium.UI.FILL visible="false" top="30"> 
    <Label class="networkLabel">Oops! No Internet Connection. Please retry again later</Label> 
</View> 
<NavigationWindow id="win1" platform="ios" zIndex= 1 > 
<Window id="win" class="container" title="Login"> 
     <View id="specificError" class="network" width= Titanium.UI.FILL visible="false" top="50"> 
     <Label class="networkLabel">Oops! Something went wrong. We're on it.</Label> 
    </View> 
    <View class="headingView"> 
     <ImageView id="iconImage" image="images/xx.png" opacity="0.8" /> 
     <Label id="headingLabel">xxx</Label> 
     <Label class="subheadLabel">xxxxxxx</Label> 
    </View> 

    <View class="formView"> 
     <TextField id="xx" height="50" value="xx"> 
      <ImageView id="iconEmailImage" image="images/iOS_Login_Email_Icon.png" /> 
     </TextField> 
     <View id="borderBottom"></View> 

     <TextField passwordMask="true" id="password" height="50" value="xxx"> 
      <ImageView id="iconPwdImage" image="images/iOS_Login_Pwd_Icon.png" /> 
     </TextField> 
     <View id="borderBottom"></View> 

     <Button id="btnLogin" title="LOGIN" height="50" color="#ffffff" backgroundColor="#8EBECC" textAlign="Titanium.UI.TEXT_ALIGNMENT_CENTER" onClick="doLogin"></Button> 

    </View> 

    <View class="footerView"> 
     <ImageView id="XX" image="images/XX.png"></ImageView> 
     <Label class="copyrightLabel">copyright(c) 2015 xxx Co.All rights reserved. </Label> 
    </View> 
</Window> 

</NavigationWindow> 

回答

0

您可以通過以下招數達致這,我這是怎麼修復了這個問題。

textName.addEventListener("focus", function() 
    window.animate({bottom: "30%", duration:500}); 
}); 

textName.addEventListener("blur", function() { 
    window.animate({bottom: 0, duration:500}); 
}); 
1

最簡單的方法就是在窗口中添加一個ScrollView。添加頂部,底部和contentHeight屬性,如下例所示。通常,我通過TSS或通過ScrollView上的類屬性來完成此操作,並在tss文件中聲明。

<Alloy> 
    <NavigationWindow id="win1" platform="ios" zIndex="1"> 
     <Window id="win" class="container" title="Login"> 
      <ScrollView top="0" bottom="0" contentHeight="Ti.UI.SIZE"> 
       <!-- Your window child view elements --> 
      </ScrollView> 
     </Window> 
    </NavigationWindow> 
</Alloy> 
+0

這是工作很好。謝謝! – eaglemac