如何使用在 xamarin (iOS) 中打开键盘的按钮

问题描述 投票:0回答:1

我正在尝试做一个聊天页面,所以我有一个条目和一个按钮来发送消息,两者都在滚动视图的绝对布局中,但是当我的键盘打开时,我无法单击我的按钮,键盘关闭然后我必须再次单击,我的页面顶部有另一个按钮来关闭页面,当我滚动到顶部时,该按钮在键盘打开的情况下工作,它不是来自我在 C# 中的函数,如果我输入,两个按钮都可以工作它们在我的页面顶部。您知道我的问题可能出在哪里吗? (如果我放一个 ImageButton 而不是 Button,同样的事情)

<ImageButton x:Name="CloseBtn" Source="close.png" WidthRequest="25" TranslationX="352" TranslationY="30" Clicked="Close"></ImageButton>
<Entry x:Name="EntryChat" Text="" HeightRequest="45" TranslationX="25" WidthRequest="335" Completed="Chat" Placeholder="Saisissez votre message" BackgroundColor="#e9e9e9" TextColor="#8f8983" PlaceholderColor="#8f8983" TranslationY="650" />
<Button x:Name="Btn" CornerRadius="10"  BackgroundColor="#cecece" WidthRequest="70" HeightRequest="45" TranslationX="325" TranslationY="650"  Clicked="Chat"  ></Button>
xamarin button xamarin.forms xamarin.ios keyboard
1个回答
0
投票

您可以在条目中使用

Completed
。可以通过读取 Text 属性来访问输入的文本,并且 TextChanged 和 Completed 事件表示文本已更改或已完成。

<Entry x:Name="entry"
       Placeholder="Enter text"
       TextChanged="OnEntryTextChanged"
       Completed="OnEntryCompleted" />
© www.soinside.com 2019 - 2024. All rights reserved.