在带有 angular 的 nativescript 中,当键盘打开时,它会将我的元素(操作栏)推出屏幕 (ANDROID)
in nativescript with angular, when keyboard is open, it pushes my element (action bar) out of the screen (ANDROID)
我的 android 键盘在使用 Angular 时遇到了问题。
我正在尝试制作类似 whatsapp 的消息服务,但当我尝试在 Android 上写消息时遇到问题。
here's my interface (forget the paint S image)
当我点击输入区域时,我有这个
when my keyboard is open
如您所见,我的列表视图和操作栏像输入区域一样被推送。但是,在我制作的另一个应用程序上,我没有这个问题(只有输入 aera 被推送)
before tapping
after tapping
这里是html代码:
<ActionBar title="{{other.name}}"
class="app-action-bar">
<NavigationButton text=""
android.systemIcon="ic_menu_back"
(tap)="goback()"></NavigationButton>
</ActionBar>
<GridLayout rows="*, auto">
<ListView #chatBox
separatorColor="transparent"
[items]="messages"
(loaded)="scrollChatToBottom()"
row="0"
style="height:100%"
(tap)="hidekeyboard()">
<ng-template let-item="item">
<GridLayout class="bubble-container">
<StackLayout isUserInteractionEnabled="false"
[class]="bubbleClass(item)">
<StackLayout orientation="horizontal">
<Image src="res://ic_trombone"
class="icon-attach"
*ngIf="item.attachment"></Image>
<Label editable="false"
class="message-content"
textWrap="true"
[text]="item.content"></Label>
</StackLayout>
<Label [text]="item.date | timeAgo"
class="message-date"></Label>
</StackLayout>
<Label editable="false"
*ngIf="item.sender.name != 'Moi' && item.sender.name != mename "
[style.background-color]="item.sender.pictureUrl"
[style.color]="getBestcontrastColor(other.pictureUrl)"
class="content-avatar"
text="{{makeinitial(other.name)}}"></Label>
</GridLayout>
</ng-template>
</ListView>
<StackLayout row="1"
*ngIf="status!='résolu'"
class="background">
<GridLayout rows="*,*"
class="message-box">
<GridLayout row="0"
columns="*,auto"
class="message-box-field">
<Image *ngIf="newMessage.text.length==0"
class="fa attach"
src="res://ic_trombone"
col="0">
</Image>
<TextView #newMessage
editable="true"
(focus)="onfocused()"
hint="Write a message..."
textWrap="true"
[(ngModel)]="newMessage.text"
(ngModelChange)="textChanged($event)"
[style.height]="textHeight"
[style.width]="textWidth"
class="write-message-field"
col="1"></TextView>
</GridLayout>
<GridLayout row="1"
*ngIf="newMessage.text.length>0"
columns="*,*"
class="action-container">
<Image class="fa attach"
src="res://ic_trombone"
col="0">
</Image>
<Image col="1"
(tap)="sendMessage()"
src="res://ic_arrow_up"
class="fa arrow">
</Image>
</GridLayout>
</GridLayout>
</StackLayout>
</GridLayout>
对于 android,TextHeigh 总是 "auto"。
当用户键入时,TextWidth 从 85% 变为 100%。
所以,我不明白为什么我的操作栏和列表视图会被推送到这个应用程序上...
请...
您能否检查您的 Android 清单以确保您拥有此配置?
"android:configChanges="键盘隐藏|方向|屏幕大小
对我来说它在文件中: App_Ressources/Android/values/styles.xml ,我在 <item name="android:windowFullscreen">false</item>
中将 true 更改为 false
有效
我的 android 键盘在使用 Angular 时遇到了问题。
我正在尝试制作类似 whatsapp 的消息服务,但当我尝试在 Android 上写消息时遇到问题。
here's my interface (forget the paint S image)
当我点击输入区域时,我有这个
when my keyboard is open
如您所见,我的列表视图和操作栏像输入区域一样被推送。但是,在我制作的另一个应用程序上,我没有这个问题(只有输入 aera 被推送)
before tapping
after tapping
这里是html代码:
<ActionBar title="{{other.name}}"
class="app-action-bar">
<NavigationButton text=""
android.systemIcon="ic_menu_back"
(tap)="goback()"></NavigationButton>
</ActionBar>
<GridLayout rows="*, auto">
<ListView #chatBox
separatorColor="transparent"
[items]="messages"
(loaded)="scrollChatToBottom()"
row="0"
style="height:100%"
(tap)="hidekeyboard()">
<ng-template let-item="item">
<GridLayout class="bubble-container">
<StackLayout isUserInteractionEnabled="false"
[class]="bubbleClass(item)">
<StackLayout orientation="horizontal">
<Image src="res://ic_trombone"
class="icon-attach"
*ngIf="item.attachment"></Image>
<Label editable="false"
class="message-content"
textWrap="true"
[text]="item.content"></Label>
</StackLayout>
<Label [text]="item.date | timeAgo"
class="message-date"></Label>
</StackLayout>
<Label editable="false"
*ngIf="item.sender.name != 'Moi' && item.sender.name != mename "
[style.background-color]="item.sender.pictureUrl"
[style.color]="getBestcontrastColor(other.pictureUrl)"
class="content-avatar"
text="{{makeinitial(other.name)}}"></Label>
</GridLayout>
</ng-template>
</ListView>
<StackLayout row="1"
*ngIf="status!='résolu'"
class="background">
<GridLayout rows="*,*"
class="message-box">
<GridLayout row="0"
columns="*,auto"
class="message-box-field">
<Image *ngIf="newMessage.text.length==0"
class="fa attach"
src="res://ic_trombone"
col="0">
</Image>
<TextView #newMessage
editable="true"
(focus)="onfocused()"
hint="Write a message..."
textWrap="true"
[(ngModel)]="newMessage.text"
(ngModelChange)="textChanged($event)"
[style.height]="textHeight"
[style.width]="textWidth"
class="write-message-field"
col="1"></TextView>
</GridLayout>
<GridLayout row="1"
*ngIf="newMessage.text.length>0"
columns="*,*"
class="action-container">
<Image class="fa attach"
src="res://ic_trombone"
col="0">
</Image>
<Image col="1"
(tap)="sendMessage()"
src="res://ic_arrow_up"
class="fa arrow">
</Image>
</GridLayout>
</GridLayout>
</StackLayout>
</GridLayout>
对于 android,TextHeigh 总是 "auto"。 当用户键入时,TextWidth 从 85% 变为 100%。
所以,我不明白为什么我的操作栏和列表视图会被推送到这个应用程序上... 请...
您能否检查您的 Android 清单以确保您拥有此配置? "android:configChanges="键盘隐藏|方向|屏幕大小
对我来说它在文件中: App_Ressources/Android/values/styles.xml ,我在 <item name="android:windowFullscreen">false</item>
有效