Layout problem

mgregory22mgregory22 Member ✭✭

I'm new to Xamarin and I can't figure how to get rid of the gap between the two rows of my grid. I set all the margins and padding to zero that I could:

  <ListView x:Name="_listView"
            ItemSelected="OnListViewItemSelected"
            HasUnevenRows="True"
            >
    <ListView.ItemTemplate>
      <DataTemplate>
        <ViewCell>
          <Frame BorderColor="Black"
                 Margin="0"
                 Padding="0"
                 >
            <Grid>
              <Grid.RowDefinitions>
                <RowDefinition Height="30" />
                <RowDefinition Height="Auto" />
              </Grid.RowDefinitions>
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="3*" />
                <ColumnDefinition />
              </Grid.ColumnDefinitions>
              <Label Text="{Binding Date}"
                     Margin="0"
                     />
              <Button Grid.Column="1"
                      Text="&lt;"
                      HeightRequest="30"
                      HorizontalOptions="End"
                      WidthRequest="50"
                      VerticalOptions="End"
                      Margin="0"
                      Padding="0"
                      />
              <Label Grid.Row="1"
                     Grid.ColumnSpan="2"
                     Text="{Binding Text}"
                     FontSize="Large"
                     LineBreakMode="WordWrap"
                     MaxLines="2"
                     Margin="0"
                     />
            </Grid>
          </Frame>
        </ViewCell>
      </DataTemplate>
    </ListView.ItemTemplate>
  </ListView>

The result looks has a big gap between the date and the body:

us.v-cdn.net/5019960/uploads/editor/iv/1suw2sz8fp3n.png

I'm trying to clone this app:

us.v-cdn.net/5019960/uploads/editor/gt/jfvqob5bb18t.jpg

I'd also like to know how to draw those ruled lines if anyone can help with that.

Thanks!

Best Answer

Answers

  • mgregory22mgregory22 Member ✭✭

    Yes! Thank you for taking the time! That's interesting, but I don't think that's how I want to solve it because once I start putting my padding and margins back in the way I want them, it makes the rows overlap and things get cut off. But you taught me about RowSpacing, which gave me the idea of putting frames around everything so I can see where the spacing is coming from.

    us.v-cdn.net/5019960/uploads/editor/7b/gun005pbqf22.png

    I think I can figure it out from here. Thank you!

Sign In or Register to comment.