2017-11-15 6 views
1

Ich habe ein Raster mit Beschriftungen, jedes "Tile" hat eine transparente Hintergrundfarbe, aber der Text scheint auch transparent zu sein. Gibt es eine Möglichkeit, die Transparenz vom Etikettentext zu entfernen?Setzen Sie den Beschriftungstext auf nicht transparent

Mein Code:

<?xml version="1.0" encoding="utf-8" ?> 
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
      xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
      x:Class="LoyaltyWorx.GridMenu" 
      BackgroundImage="grid.jpg" 
      Title="Main Menu" 
      > 
    <Grid> 
     <Grid.RowDefinitions> 
      <RowDefinition Height="*" /> 
      <RowDefinition Height="2*" /> 
      <RowDefinition Height="*" /> 
     </Grid.RowDefinitions> 
     <Grid.ColumnDefinitions> 
      <ColumnDefinition Width="1*" /> 
      <ColumnDefinition Width="2*" /> 
     </Grid.ColumnDefinitions> 
     <Label Text="Cards" TextColor="White" FontAttributes="Bold" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Grid.Row="0" Grid.Column="0" BackgroundColor="#1481BA" Opacity="0.5" x:Name="CardTile"/> 
     <Label Text="Transactions" TextColor="Black" FontAttributes="Bold" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Grid.Row="0" Grid.Column="1" BackgroundColor="#ede890" Opacity="0.5" x:Name="TransactionTile"/> 
     <Label Text="Promotions" TextColor="White" FontSize="30" FontAttributes="Bold" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Grid.Row="1" Grid.Column="0" BackgroundColor="#1481BA" Grid.ColumnSpan="2" Opacity="0.7" x:Name="PromoTile"/> 
     <Label Text="Settings" TextColor="Black" FontAttributes="Bold" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Grid.Row="2" Grid.Column="0" BackgroundColor="#ede890" Opacity="0.5" x:Name="SettingsTile" /> 
     <Label Text="My Profile" TextColor="White" FontAttributes="Bold" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Grid.Row="2" Grid.Column="1" BackgroundColor="#1481BA" Opacity="0.5" x:Name="ProfileTile"/> 
    </Grid> 
</ContentPage> 

ScreenShot:

screenshot

+0

Sie müssen wahrscheinlich ein "Label" (oder "BoxView" oder "Frame") für die Hintergrundfarbe erstellen und dann ein "Label" mit einem transparenten Hintergrund, aber nicht den Text, also den Text wird deutlich gezeigt –

Antwort

0

Sie benötigen Etikett in StackLayout sieht wie folgt hinzuzufügen:

<StackLayout Grid.Row="0" Grid.Column="0" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" BackgroundColor="#1481BA" Opacity="0.5" > 
    <Label Text="Cards" TextColor="White" FontAttributes="Bold" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" BackgroundColor="Transparent" x:Name="CardTile"/> 
</StackLayout> 

Sie können auch Frame anstelle von StackLayout

Verwandte Themen