2
我有一個UWP應用程序,當虛擬鍵盤打開時,我的機器人會被推上去。是否可以讓scrollviewer保持原位,並在虛擬鍵盤打開時讓文本框保持在視圖中。UWP虛擬鍵盤將內容向上推
我看到你可以訂閱開放和隱藏事件,但是這並沒有給我任何選擇ui元素可以保留或隱藏。 https://docs.microsoft.com/en-us/windows/uwp/input-and-devices/respond-to-the-presence-of-the-touch-keyboard
<Page
x:Class="VirtualKeyboardFix.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:VirtualKeyboardFix"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<ScrollViewer >
<Image Source="image.png" />
</ScrollViewer>
<TextBox HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="10" />
</Grid>
</Page>
通常情況下,內容被拉高了,如果沒有足夠的空間供鍵盤顯現。這是這種情況嗎? –
添加圖像是否有助於回答該問題?哦。我明白你的意思。在這種情況下,圖像大小與屏幕大小相同。 – Haydn
您可以嘗試手動設置文本框的偏移量(負值)。 –