简体   繁体   English

Titanium - ScrollView中的Textarea

[英]Titanium - Textarea within a ScrollView

I am trying to create a textarea box within a scrollview. 我正在尝试在scrollview中创建一个textarea框。 The problem is that it works in iOS, but in Android, when typing multiple lines within the textarea, I cannot scroll up and down to view what I have typed. 问题是它适用于iOS,但在Android中,当在textarea中键入多行时,我无法上下滚动查看我输入的内容。 I know in native Android that you can provide a maximum number of lines and the scrollbars to allow in the view XML file that allows a scrollable textarea within a scrollview, but is there a way to do something similar or a different way of doing this for Titanium? 我知道在原生Android中你可以提供最大数量的行和滚动条,以允许在视图XML文件中允许滚动视图中的可滚动文本区域,但有没有办法做类似或不同的方式来执行此操作钛?

Here is the code which I am using: 这是我正在使用的代码:

var win = Ti.UI.createWindow({
    title: 'Test',
    backgroundColor: 'transparent'
});

var view = Ti.UI.createScrollView({
    top: 10,
    left: 10,
    right: 10,
});

var ta = Ti.UI.createTextArea({
    top: 5,
    left: 5,
    right: 5,
    height: 400,
    backgroundColor: '#AA8BC9'
});

var btn = Ti.UI.createButton({
    top: 800,
    left: 10,
    right: 10,
    width: Ti.UI.FILL,
    height: Ti.UI.SIZE,
    backgroundColor: 'FF00CC',
    text: 'OK'
});

view.add(ta);
view.add(btn);
win.add(view);
win.open();

Kibria, This is the problem in old titanium sdk. Kibria,这是老钛sdk的问题。 I also facing this problem with tableview and scrollview in android. 我也在android中遇到tableview和scrollview这个问题。 I hope this problem can resolve in new titanium sdk. 我希望这个问题可以解决新的钛sdk。

The alternative solution is you need to set scrollview layout to vertical. 替代解决方案是您需要将scrollview布局设置为垂直。 and your TextArea height set to auto and then add your button. 并将TextArea高度设置为auto,然后添加按钮。 In this way your scrollview and textarea works perfect for you. 通过这种方式,您的scrollview和textarea非常适合您。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM