作为Xamarin的新手,我创建了一个应用程序,其中包含一些带有少量图像的登录页面。
我将不同大小的图像放在资源中相关的可绘制文件夹中,但无论我为Android测试的设备大小,都会始终选择默认图像。
我的印象(可能是错误的)Android可以确定要使用的正确资源,所以除了在我的XAML页面中设置图像源之外,还有其他“连接”我必须做的才能获得正确的图片?此外,文本也没有调整大小,但猜测是因为我手动设置了字体大小?
- 编辑 -
below is the content from the XAML
<ContentPage.Content>
<!-- MAIN WRAPPER -->
<Grid>
<!-- ICON BACKGROUND -->
<Grid.RowDefinitions>
<RowDefinition Height="150" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackLayout Padding="0,0,0,380" VerticalOptions="Center" HorizontalOptions="Center" x:Name="logoStack">
<Label Text="" />
<Image x:Name="logo" Source="MyLogo.png"
Grid.Row="1"
HorizontalOptions="Center"
Aspect="AspectFill"
VerticalOptions="Center"
/>
<Label Text="" />
</StackLayout>
<StackLayout Padding="0,110,0,0" VerticalOptions="Center" HorizontalOptions="Center" x:Name="imgStack">
<Image
x:Name="img"
Grid.Row="2"
Source=""
HorizontalOptions="Center"
Aspect="AspectFill"
VerticalOptions="Center"
/>
</StackLayout>
<Grid
Grid.Row="0"
Padding="0"
Margin="0,30,0,0"
VerticalOptions="Center" >
<!--FIRST LEVEL ELLIPSIS-->
<Label
Style="{DynamicResource WalktrhoughItemTemplateShape}"
FontSize="360"
/>
<!--SECOND LEVEL ELLIPSIS-->
<Label
Style="{DynamicResource WalktrhoughItemTemplateShape}"
FontSize="260"
/>
<!--SECOND LEVEL ELLIPSIS-->
<Label
Style="{DynamicResource WalktrhoughItemTemplateShape}"
FontSize="180"
/>
<!--ICON BACKGROUND-->
<Label
Style="{DynamicResource WalktrhoughItemTemplateShape}"
FontSize="130"
Opacity="0.3"
/>
<!--ICON-->
<Label
x:Name="IconLabel"
Style="{DynamicResource WalkthroughStepIconStyle}"
VerticalOptions="Center"
Text="{ x:Static font:GrialShapesFont.LogoGrial }"
/>
</Grid>
<!--TEXT -->
<StackLayout x:Name="headerStack"
Grid.Row="3"
Padding="20, 40, 20, 0"
VerticalOptions="Center" HorizontalOptions="Center">
<Label
x:Name="HeaderLabel"
HorizontalTextAlignment="Center"
HorizontalOptions="CenterAndExpand"
Text=""
FontSize="22"
FontFamily="Helvetica Neue"
TextColor="#E9F2F8"/>
</StackLayout>
<StackLayout x:Name="txtStack"
Grid.Row="4"
Padding="20, 0, 20, 0"
VerticalOptions="Center" HorizontalOptions="Center">
<Label
x:Name="DescriptionLabel"
HorizontalTextAlignment="Center"
HorizontalOptions="CenterAndExpand"
Opacity="0.7"
Text=""
FontSize="14"
FontFamily="Helvetica Neue"
TextColor="#E9F2F8"/>
</StackLayout>
<StackLayout Grid.Row="5" x:Name="sIndicator"
Padding="20, 25, 20, 0"
Spacing="0"
>
<Image
x:Name="indicator"
Source=""
HorizontalOptions="Center"
Aspect="AspectFill"
WidthRequest="140"
HeightRequest="10"
VerticalOptions="Center"
/>
</StackLayout>
<!--BUTTON-->
<StackLayout Grid.Row="6" x:Name="sButton">
<artina:Button
Grid.Row="6"
Margin="20"
Style="{DynamicResource PrimaryActionButtonStyle}"
x:Name="PrimaryActionButton"
BackgroundColor="#FFFFFF"
TextColor="#2980B9"
VerticalOptions="End"
Command="{Binding LoginPageRedirect}"
Text="Login"/>
</StackLayout>
<!--BUTTON-->
</Grid>
</ContentPage.Content>
感谢