Listview xamarin表单:flex布局如何适应比容器大的内容
上述xaml是在listview中使用的datatemplate内创建的。我可以显示内容,但最后一个标签没有扩展flexlayout以适应所有内容 下图:Listview xamarin表单:flex布局如何适应比容器大的内容,listview,xamarin,layout,Listview,Xamarin,Layout,上述xaml是在listview中使用的datatemplate内创建的。我可以显示内容,但最后一个标签没有扩展flexlayout以适应所有内容 下图: 我尝试了您的代码,但没有找到让flexlayout自动展开的解决方案。我试过了,但没有成功 如果只有一个FlexLayout,它将工作: <FlexLayout Direction="Row" JustifyContent="Start"> <circle:CircleImage
我尝试了您的代码,但没有找到让
flexlayout
自动展开的解决方案。我试过了,但没有成功
如果只有一个FlexLayout
,它将工作:
<FlexLayout Direction="Row" JustifyContent="Start">
<circle:CircleImage
BackgroundColor="Blue"
Style="{StaticResource profileStyle}"
Source="{Binding TeacherSource}">
</circle:CircleImage>
<FlexLayout
FlexLayout.Grow="1"
Direction="Column"
BackgroundColor="Red"
JustifyContent="SpaceEvenly">
<Label Text="{Binding TeacherName}" Style="{DynamicResource ListItemTextStyle}"></Label>
<Label Text="{Binding TeacherEmail}" Style="{DynamicResource ListItemTextStyle}"></Label>
<Label Text="{Binding TeacherMobile}" Style="{DynamicResource ListItemTextStyle}"></Label>
<Label Text="{Binding TeacherHome}" Style="{DynamicResource ListItemTextStyle}"></Label>
<Label Text="{Binding TeacherWork}" Style="{DynamicResource ListItemTextStyle}"></Label>
</FlexLayout>
</FlexLayout>
<FlexLayout
FlexLayout.Grow="1"
Direction="Column"
BackgroundColor="Red"
JustifyContent="SpaceEvenly">
<Label Text="{Binding TeacherName}" Style="{DynamicResource ListItemTextStyle}"></Label>
<Label Text="{Binding TeacherEmail}" Style="{DynamicResource ListItemTextStyle}"></Label>
<Label Text="{Binding TeacherMobile}" Style="{DynamicResource ListItemTextStyle}"></Label>
<Label Text="{Binding TeacherHome}" Style="{DynamicResource ListItemTextStyle}"></Label>
<Label Text="{Binding TeacherWork}" Style="{DynamicResource ListItemTextStyle}"></Label>
</FlexLayout>
请记住设置您的列表视图
行数=“True”,不要设置行高
更改为StackLayout效果非常好。非常感谢。
<FlexLayout Direction="Row" JustifyContent="Start">
<Image Source="Images"></Image>
<StackLayout Orientation="Vertical">
<Label Text="{Binding Name}"></Label>
<Label Text="{Binding Image}"></Label>
<Label Text="{Binding Image}"></Label>
<Label Text="{Binding Image}"></Label>
<Label Text="{Binding Image}"></Label>
</StackLayout>
</FlexLayout>