如何將視圖的寬度設定為父視圖的百分比?我試過了,WidthRequest=0.2*但這似乎只適用于網格。有沒有辦法為任何其他視圖進行類似的設定,或者我唯一的選擇是以編程方式設定它?
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="SnipSnip.SnippetsPage"
Title="SnippetsPage">
<AbsoluteLayout>
<ListView x:Name="SnippetsListView">
<ListView.ItemTemplate>
<DataTemplate>
<TextCell Text="{Binding Name}" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<Editor/>
</AbsoluteLayout>
</ContentPage>
在此示例中,我希望ListView.2*Editor的寬度和 .8* 的寬度
謝謝
uj5u.com熱心網友回復:
我也認為你應該只使用網格。AbsoluteLayout 就是它所說的:它是絕對的。沒有辦法讓它自動使用它所擁有的空間的一半或類似的東西。這就是網格的用途。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/529814.html
標籤:xml毛伊岛
上一篇:MAUI使按鈕調整大小以適合文本
