2015-11-27 77 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