【发布时间】:2019-02-08 20:27:57
【问题描述】:
我需要更改网格内按钮的大小 ....
当添加属性 HightRequest 和 WidthRequest 时,这不会在我的应用程序中进行任何更改......这为什么会发生?我应该怎么做才能修改网格上按钮的大小?
对我有什么帮助吗?
MyView.XAML:
<StackLayout
Padding="5">
<SearchBar
Placeholder="Buscar..."
BackgroundColor="White">
</SearchBar>
<Grid HorizontalOptions="FillAndExpand">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label
Grid.Column="0"
Grid.Row="0"
Text="(1537) CLORO, GAS LICUADO"
VerticalOptions="Center">
</Label>
<Button
Grid.Column="1"
Grid.Row="0"
Text="VER"
BackgroundColor="Orange"
TextColor="White"
HeightRequest="5"
WidthRequest="5">
</Button>
<Button
Grid.Column="2"
Grid.Row="0"
Text="HDS"
BackgroundColor="Blue"
TextColor="White">
</Button>
<Label
Grid.Column="0"
Grid.Row="1"
Text="(11) ACTION 707"
VerticalOptions="Center">
</Label>
<Button
Grid.Column="1"
Grid.Row="1"
Text="VER"
BackgroundColor="Orange"
TextColor="White">
</Button>
<Button
Grid.Column="2"
Grid.Row="1"
Text="HDS"
BackgroundColor="Blue"
TextColor="White">
</Button>
</Grid>
</StackLayout>
【问题讨论】:
-
行索引 1 超出网格行定义范围 (0-0)
-
您想在我的网格中添加另一个元素
吗?或更改 GRID.ROWS? @toumir -
如果我理解正确,您想在列表中显示搜索结果,每个项目列表都有一个标签和两个按钮?还是行是固定的?
-
在这种情况下...该行是固定的@toumir
标签: xaml xamarin button gridview xamarin.forms