How to set form Background as transparency in portable cross platform xamarin form?

前端 未结 3 988
别那么骄傲
别那么骄傲 2021-01-12 07:10

I am using Portable xamarin cross platform. I have two project android and IOS.

I have to make form as transparent form. I have written code for same and this code p

相关标签:
3条回答
  • 2021-01-12 07:54

    Just include opacity property to your stacklayout :

    <StackLayout VerticalOptions="End" HorizontalOptions="FillAndExpand"  BackgroundColor="#80000000" Opacity="0.5" HeightRequest="160"  Grid.Row="2" >
      <Label Text="05:00" FontSize="60" FontAttributes="Bold" TextColor="White" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" ></Label>
    </StackLayout>
    
    0 讨论(0)
  • 2021-01-12 08:03

    Even simpler solution would be to just change the hex values of the alpha channel.

    FBC1BC is a solid color but #00FBC1BC is a transparent, due to 00 which set the alpha of the color to 0 or transparent.

    So just do this #FBC1BC > #50FBC1BC

    And you will get a transparent background color with alpha defined by the first two values!

    0 讨论(0)
  • 2021-01-12 08:09

    SIMPLE AS THIS

    BackgroundColor = Color.Transparent
    

    OR in xaml

     `<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="XXX.Core.Views.Pages.XXXX.XXXX"
             xmlns:local="clr-namespace:XXX.Core.Views.CustomControls"    
             BackgroundColor="Transparent">`
    
    0 讨论(0)
提交回复
热议问题