是否有任何解决方案可以将我的文本范围扩展到父边界并为每个边界占用相似数量的空间?期望的结果:
我现在有:
P.S。我试图使用跨度绘制一周(可能会在一个月之后尝试),因为每天365页TextViews的页面绘制速度会变慢。
答案 0 :(得分:0)
由于您没有发布任何代码,我不知道您是如何实现布局的。
但是,如果您想要自定义自己的日历视图而不是原生Android提供的CalendarView组件,则可以使用GridView
,它在二维可滚动网格中显示项目。网格项将使用ListAdapter
自动插入布局。
这绝对可以解决TextView
的对齐问题,您可以在此处查看使用GridView
的示例:Grid View。
此外,您可以参考此博客使用GridView
创建自定义日历:Android Customization: How to Build a UI Component That Does What You Want,这是原生Android的java,但对于Xamarin,它们非常相似。
答案 1 :(得分:0)
因为您没有提到任何代码,所以我想向您介绍我制作日历以覆盖整个宽度(等间隔的日期块)的要点:
<StackLayout>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackLayout Grid.Row="0" Grid.Column="0">
<Label Text="1"/>
</StackLayout>
and so on...
</StackLayout>