Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 81910

Keyboard entry pushes ListView item off the screen - help

$
0
0

Have an issue in my chat window, similar to what Nish demonstrated in DataTemplateSelector article, here I'm using forked copy of his code to
explain the issue:

I've added < ScrollView > arround < RelativeLayout > to prevent the keyboard from overlapping the entry box,

 <ScrollView>   
  <RelativeLayout>
  <ListView x:Name="MessagesListView" 
            ItemTemplate="{StaticResource MessageTemplateSelector}" 
            ItemsSource="{Binding Messages}"
            HasUnevenRows="True" 
            ItemSelected="MyListView_OnItemSelected"
            ItemTapped="MyListView_OnItemTapped"
            SeparatorVisibility="None"
            RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent,Property=Height,Factor=1,Constant=0}">
   </ListView>
    <Grid x:Name="MessageControls" RowSpacing="1" ColumnSpacing="2" Padding="5"
          BackgroundColor="#EFEFF4"
          VerticalOptions="FillAndExpand"
          HorizontalOptions="FillAndExpand"
          RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=MessagesListView, Property=Height,Factor=.91,Constant=0}"
          RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent,Property=Width,Factor=1,Constant=0}"
          RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=MessagesListView, Property=Height,Factor=.09,Constant=0}">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"></ColumnDefinition>
        <ColumnDefinition Width="Auto"></ColumnDefinition>
      </Grid.ColumnDefinitions>
      <Entry Grid.Column="0" HeightRequest="25" Placeholder="Message" Text="{Binding OutGoingText}"></Entry>
      <Button Grid.Column="1" Text="Send" Command="{Binding SendCommand}"></Button>
    </Grid>

  </RelativeLayout>
</ScrollView>

So now you can see the entry box, but when there is only one entry in the ListView, the keyboard pushes it off the
screen and not able to see what are you responding to:

No problem when the last item is past the 1/2 of the screen:

link to my copy of the code


Viewing all articles
Browse latest Browse all 81910

Trending Articles



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