如何在 xamarin 中實作這種設計?我正在嘗試實作一個串列,在水平滾動期間固定第 0 列的所有行,并且第 1 列的所有行將水平滾動。請看圖片。
我有串列資料。你知道任何插件/組件來實作這一點嗎?

我在這里嘗試..
<StackLayout Grid.ColumnSpan="2" Grid.RowSpan="4">
<StackLayout Orientation="Horizontal" Padding="10" Spacing="50" BackgroundColor="Gray" HorizontalOptions="FillAndExpand">
<Label Text="List Header" HorizontalOptions="Start" FontSize="Small" TextColor="White" FontAttributes="Bold" />
<Label Text="18:00" HorizontalOptions="End" FontSize="Small" TextColor="White" FontAttributes="Bold" />
<Label Text="18:30" HorizontalOptions="End" FontSize="Small" TextColor="White" FontAttributes="Bold" />
<Label Text="19:00" HorizontalOptions="End" FontSize="Small" TextColor="White" FontAttributes="Bold" />
</StackLayout>
<ListView ItemsSource="{Binding DataTypes}" ItemTapped="DataType_Selected" >
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout BackgroundColor="#eee" Orientation="Vertical">
<Grid >
<Label Text="{Binding DataName}" Grid.Column="0" Grid.ColumnSpan="3" TextColor="#f35e20" FontAttributes="Bold" />
<Label Text="Avail" Grid.Column="3" TextColor="Black" FontAttributes="Bold" />
<Label Text="Not" Grid.Column="4" TextColor="Black" FontAttributes="Bold" />
<Label Text="Avail" Grid.Column="5" TextColor="Black" FontAttributes="Bold" />
</Grid>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
uj5u.com熱心網友回復:
您可以使用網格或堆疊布局作為父布局,然后使用包含堆疊布局的滾動視圖,其中包含串列視圖。

就像圖片所示,您可以使用 scrollvoew 使串列視圖垂直和水平滾動。
<ScrollView Orientation="Horizontal" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
<StackLayout>
//the listview
</StackLayout>
</ScrollView>
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/506310.html
