在IOS中,xamarin中的奇怪左边填充表单列表视图

时间:2016-11-24 11:55:22

标签: listview xamarin xamarin.ios xamarin.forms

我很难在iOS中正确对齐ListView,Androind很好

有两个问题:

首先,在iOS上我在堆栈面板的列表视图中得到左边距/边距,我不知道它来自哪里(见图像:https://us.v-cdn.net/5019960/uploads/thumbnails/FileUpload/b7/8fa8930c5f40605e51e4697d2e4285.png

<Grid RowSpacing="0" lb:GridLayout.RowHeights="Auto,*,Auto">
        <shared:Header TextColor="#357dd3" TitleText="NEW ACCOUNT" />

        <ScrollView Grid.Row="1" HorizontalOptions="FillAndExpand">
            <Grid lb:GridLayout.RowHeights="Auto,Auto,*" HorizontalOptions="FillAndExpand">
                <Grid Grid.Row="0" lb:GridLayout.ColumnWidths="*,*,*" HeightRequest="80" VerticalOptions="Start">
                    <Image Grid.Column="1" Source="login_details_add.png" Aspect="AspectFit" Margin="0,0,0,0" />
                </Grid>

                <Grid Grid.Row="1" lb:GridLayout.ColumnWidths="*,7*,*" VerticalOptions="Start">
                    <shared:PageTitle Grid.Column="1" Padding="20" HorizontalOptions="CenterAndExpand"
                                            TitleText="Address Details" 
                                            DescriptionText="To give you the best possible search suggestions we need to know your address." />
                </Grid>

                <StackLayout Grid.Row="2" Padding="20">
                    <Grid RowSpacing="2" lb:GridLayout.RowHeights="Auto,10,*">
                        <entries:FloatingLabelTextBox Grid.Row="0" Placeholder="Your street address (unit optional)" Text="{Binding SearchText}" Grid.Column="0" x:Name="SearchText" Keyboard="Text" />

                        <StackLayout Grid.Row="2" IsVisible="{Binding HasResults}">
                            <ListView x:Name="SearchResults" ItemsSource="{Binding Addresses}" SelectedItem="{Binding SelectedAddress}">
                                <ListView.ItemTemplate>
                                  <DataTemplate>
                                    <TextCell Text="{Binding StreetAddress}" Detail="{Binding StateSuburbPostcode}" />
                                  </DataTemplate>
                                </ListView.ItemTemplate>
                                <ListView.Footer>
                                    <StackLayout HorizontalOptions="FillAndExpand">
                                    </StackLayout>
                                </ListView.Footer>
                            </ListView>
                        </StackLayout>
                    </Grid>

                    <StackLayout Margin="20">
                        <buttons:ActionButton Grid.Column="1" Text="Enter Manually" Command="{Binding ManualEntry}" />
                    </StackLayout>

                </StackLayout>
            </Grid>
        </ScrollView>
    </Grid>

我尝试了不同的事情无济于事。

其次,我得到了10个搜索结果,但是列表视图一直把空行放在下面,我通过将空页脚放入其中来修复。这个固定的空行被渲染,但是listview下面仍有很大的空白空间。我该如何删除它?现在我在我的视图代码后面有一个代码,它计算搜索结果的数量,将它乘以行高并设置列表视图高度,但这感觉很脏。

0 个答案:

没有答案