【发布时间】:2018-03-05 10:20:10
【问题描述】:
我使用 angular2 在 nativescript 中创建了类似 whatsapp 的消息服务,当您在 android 平台上编写消息时,我遇到了 textview 的大小(高度)问题。当您添加另一行(如whatsapp或facebook等)时,我希望增加高度。
在 IOS 中,这很简单。点击链接
dynamic size of a textview in IOS
我的 html 模板是(只是屏幕的底部):
<StackLayout class="message-box-container">
<GridLayout columns="auto, *, auto"
class="message-box">
<Label col="0"
class="fa link"
[text]="'fa-link' | fonticon">
</Label>
<GridLayout columns="auto, *"
col="1"
class="message-box-field">
<TextView #newMessage
col="0"
editable="true"
hint="Write a message..."
textWrap="true"
[(ngModel)]="newMessage.text"
(ngModelChange)="textChanged()"
[style.height]="textHeight"
class="write-message-field"></TextView>
<Label (tap)="sendMessage()"
col="1"
class="fa arrow"
[text]="'fa-arrow-circle-up' | fonticon">
</Label>
</GridLayout>
</GridLayout>
</StackLayout>
当你在 IOS 中输入时更改文本视图的大小:
textChanged() {
if (isIOS) {
this.textHeight = this.newMessage.ios.contentSize.height;
} else{//ANDROID TODO}
【问题讨论】:
标签: android textview nativescript angular2-nativescript