Reputation: 121
when user focus Entry Control in Xamarin.Form keyboard open but view scroll so Design looks ugly.so please help me. i have put image how screen visible when keyboard open in android device. My code given below
<StackLayout Grid.Row="1">
<StackLayout Padding="20,10,20,20" >
<Entry x:Name="Txtusername" Placeholder="Name"/>
<Entry x:Name="TxtPass"
IsPassword="True"
Placeholder="Password" />
<StackLayout Padding="0,10">
<Button x:Name="BtnSign"
BackgroundColor="#FFFFCB04"
BorderColor="#FFFFCB04"
Clicked="BtnSignInClicked"
Text="Sign In"
TextColor="Black" />
</StackLayout>
</StackLayout>
</StackLayout>
Upvotes: 1
Views: 3083
Reputation: 2761
Add WindowSoftInputMode=SoftInput.AdjustPan
in your [Activity()]
on top of your MainActivity class from where the FormsApplication start.
This is so that your layout does not change when keyboard is active. I think you won't need scroll here. If you want scroll then add scroll view in your code
<ScrollView>
.//your grid
.
<StackLayout Grid.Row="1">
<StackLayout Padding="20,10,20,20" >
<Entry x:Name="Txtusername" Placeholder="Name"/>
<Entry x:Name="TxtPass"
IsPassword="True"
Placeholder="Password" />
<StackLayout Padding="0,10">
<Button x:Name="BtnSign"
BackgroundColor="#FFFFCB04"
BorderColor="#FFFFCB04"
Clicked="BtnSignInClicked"
Text="Sign In"
TextColor="Black" />
</StackLayout>
</StackLayout>
</StackLayout>
</ScrollView>
Upvotes: 0