【发布时间】:2021-03-24 18:25:09
【问题描述】:
我创建了一个主页,其中包含 2 个标签和 2 个图像按钮,这 2 个图像按钮在我的手机上可见,而在三星 Galaxy s9 上不可见,或者有问题我不知道这是什么问题图片解释更多
这是我在 XAML 中的代码
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="Kitsune_Zone.MainPage"
Padding="15">
<ScrollView >
<StackLayout>
<Label
Text="Welcome to Kitsune Zone"
FontFamily="{StaticResource KitsuneFont}"
HorizontalOptions="Center"
Padding="5"
TextColor="RosyBrown"
FontSize="20"/>
<Label Text="What will you watch, Sir?"
FontFamily="{StaticResource KitsuneFont}"
HorizontalOptions="Center"
Padding="5"
Margin="5"/>
<ImageButton x:Name="Anime_Entry"
HorizontalOptions="Center"
VerticalOptions="CenterAndExpand"
CornerRadius="10">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<VisualState.Setters>
<Setter Property="Scale"
Value="1" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Pressed">
<VisualState.Setters>
<Setter Property="Scale"
Value="0.985" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</ImageButton>
<Frame BorderColor="Black" HasShadow="True">
<ImageButton x:Name="Soon_Entry"
HorizontalOptions="Center"
VerticalOptions="EndAndExpand"
CornerRadius="10">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<VisualState.Setters>
<Setter Property="Scale"
Value="1" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Pressed">
<VisualState.Setters>
<Setter Property="Scale"
Value="0.985" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</ImageButton>
</Frame>
</StackLayout>
</ScrollView>
这是我在 C# 中的代码
namespace Kitsune_Zone{
// Learn more about making custom code visible in the Xamarin.Forms previewer
// by visiting https://aka.ms/xamarinforms-previewer
[DesignTimeVisible(false)]
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
Title = "Kitsune Zone";
Anime_Entry.Source = ImageSource.FromFile("Anime_Entry.jpg");
Anime_Entry.Clicked += Anime_Entry_Click;
Soon_Entry.Source = ImageSource.FromFile("Soon.jpg");
}
private async void Anime_Entry_Click(object sender, EventArgs e)
{
await Navigation.PushAsync(new Anime_Streaming());
}
}}
现在我不知道该怎么做才能让这些项目在我的手机上显示出来
【问题讨论】:
-
你的手机和三星 Galaxy s9 版本是什么?如果您尝试将 ImageButton 更改为 Image,它可以正确显示吗?
-
您是否尝试过仅使用 Image。也尝试使用 PNG 图像
-
你是说安卓版?如果是,那么我的移动机器人版本是 10,三星 Galaxy s9 机器人版本是 9
-
我尝试将 imagebutton 更改为 image ,这是同样的问题
标签: android xamarin xamarin.forms xamarin.android xamarin.ios