Search code examples
androidxamarinxamarin.formsxamarin.androidxamarin.ios

Xamarin ImageButton visibility issue in different mobile


I have made a home page that contains 2 labels and 2 imagebuttons and the 2 imagebuttons is visible on my mobile and is not visible on Samsung galaxy s9 or there is something wrong I don't know what is the problem here is the images to explain more

this image on my mobile

and this on Samsung galaxy s9

and here is my code at 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>

and here is my code at 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());
    }
}}

now I don't know what to do to make these items appear as they appear on my phone


Solution

  • Problem Solved Guys The problem Was In Imagebutton Source Its Not Declared On All Platforms So I Decided To Put It in folder I named it imgs and made the build action of images EmbeddedResource and used it as FileResource