Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

How can I fix a view to the bottom of the parent regardless of the soft keyboard showing in Android

$
0
0

I have a view like so:

I am trying to get the Entry to appear right above the keyboard, while still keeping the list view and it's items above visible and scrollable. I'm close to this by setting AdjustResize in my MainActivity.

The problem now is that the grid view beneath the entry gets pushed above the soft keyboard. I want it to be fixed to the bottom, i.e. hidden behind the keyboard. Is there anyway to achieve this, such as align parent bottom like in Android?

I have tried using scrollviews and stacklayout VerticalOptions but these haven't created the desired effect.

Here is my Xaml as it stands:

<ContentPage.Content>
    <StackLayout BackgroundColor="LightGray">
        <Grid VerticalOptions="FillAndExpand">
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <ListView x:Name="ListView"
               . . .
            </ListView>
        </Grid>
        <StackLayout Orientation="Horizontal" IsVisible="{Binding EntryShowing}">
            <Entry x:Name="Entry"
                    Text="{Binding EntryText}"
                    TextChanged="TextChanged"
                    HorizontalOptions="FillAndExpand"
                    Placeholder="PlaceHolder" 
                    Keyboard="Numeric"/>
            <Button Text="Button" Command="{Binding Command}"
                    HorizontalOptions="End"/>
        </StackLayout>
        <Grid Margin="5, 5" VerticalOptions="End">
            <Button x:Name="Button"
                    IsVisible="False"
                    Grid.Column="0"
                    VerticalOptions="CenterAndExpand"
                    HorizontalOptions="Start"
                    HeightRequest="30"
                    Text="Button"
                    FontSize="Micro"
                    FontAttributes="Bold"
                    TextColor="White"
                    BackgroundColor="Red"
                    Command="{Binding Command}" />
            <Button x:Name="SubmitButton"
                    Grid.Column="1"
                    VerticalOptions="CenterAndExpand"
                    HorizontalOptions="End"
                    HeightRequest="30"
                    CornerRadius="3"
                    Text="Done"
                    FontSize="9"
                    TextColor="White"
                    BackgroundColor="#5989B5"
                    Command="{Binding FinishCommand}"
                    IsVisible="{Binding IsVisible}" />
        </Grid>
    </StackLayout>
</ContentPage.Content>

Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>