我尝试在Xamarin.Forms的iPad应用中调整文本框[Entry]控件的宽度和高度,但使用WidthRequest属性并不能设置宽度。
有人能否帮助我解决如何设置控件宽度的问题。
以下是我使用Grid和StackLayout的XAML代码,但它们都没有起作用。
<Grid VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto" ></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="10"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Image Grid.Row="0" Grid.Column="0" Source="loginlogo.png"></Image>
<StackLayout Grid.Row="1" Grid.Column="0">
<Entry Placeholder="Enter Username" WidthRequest="20"></Entry>
<Entry Placeholder="Enter Password" WidthRequest="20"></Entry>
<Button Text="Button 1"></Button>
</StackLayout>
</Grid>
也尝试使用堆栈布局
<StackLayout Spacing="10">
<Entry x:Name="txtUserName" Placeholder="Enter Username" WidthRequest="2" HeightRequest="200"></Entry>
<Entry x:Name="txtPassword" Placeholder="Enter Password" WidthRequest="2" HeightRequest="200"></Entry>
<Button Text="Button 1"></Button></StackLayout>