Image of image button does not stretch

영훈 정 281 Reputation points
2022-11-09T03:47:47.687+00:00

258469-image.png

258541-image.png

258513-btn-start.png

There is a phenomenon that the image does not stretch.
The image has no borders at the top or bottom.

Is there any way to make it look normal?

Developer technologies | .NET | Xamarin
0 comments No comments
{count} votes

Accepted answer
  1. JessieZhang-MSFT 7,716 Reputation points Microsoft External Staff
    2022-11-10T04:52:25.743+00:00

    Hello,

    I did a test by using the images you posted. The two images could be stretched by setting property WidthRequest and property HeightRequest.

    You can refer to the following code:

       <StackLayout VerticalOptions="StartAndExpand">   
        <Image Source="btn_start.png"  HorizontalOptions="CenterAndExpand" WidthRequest="300" HeightRequest="300" VerticalOptions="CenterAndExpand" BackgroundColor="Yellow"/>  
    
        <Image Source="btn_stop.png"  HorizontalOptions="CenterAndExpand" WidthRequest="100" HeightRequest="100" VerticalOptions="CenterAndExpand" BackgroundColor="Yellow"/>  
          
    </StackLayout>  
    

    Best Regards,
    Jessie Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.