标签不在Frame内显示文本

时间:2018-01-21 18:02:01

标签: c# xamarin xamarin.forms frame

我正在开发Xamarin.Forms中的跨平台应用程序。 我使用了框架,标签和按钮控制。按钮显示完美,但标签不在框架内显示文本。

屏幕截图是

Screenshot of the screen

我还想将按钮更改为圆角。怎么可能?

如何更改底部导航栏颜色和textColor?

我正在使用BottomNavigationBar.XF插件。

我的代码是:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         x:Class="DhirenBhai_sApp.Views.StoresPage" Title="Stores">
<ContentPage.Content>
    <StackLayout>
        <StackLayout VerticalOptions="Start" BackgroundColor="LawnGreen" HeightRequest="40">
            <Label Text="Stores" TextColor="White" VerticalOptions="Center" HorizontalOptions="Center" FontSize="Large" />
        </StackLayout>
        <Frame VerticalOptions="FillAndExpand" Margin="10" BackgroundColor="Transparent" Padding="5" >
            <Label TextColor="Black" HorizontalOptions="CenterAndExpand" Text="Stores" />
            <Label TextColor="Black" HorizontalOptions="CenterAndExpand" Text="You don't have to worry about your money being stolen from online attacks." ></Label>
            <Label TextColor="Black" HorizontalOptions="CenterAndExpand" Text="You now have the option to save your money offline, by your using a device."></Label>
            <Label TextColor="Black" HorizontalOptions="CenterAndExpand" Text="Register and find out more about the offline storage device from service provider"></Label>
            <Button Text="Register" BackgroundColor="LawnGreen" Margin="5"  BorderWidth="50" TextColor="White" VerticalOptions="End" ></Button>
        </Frame>
    </StackLayout>
</ContentPage.Content>

1 个答案:

答案 0 :(得分:2)

请尝试以下代码

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
 x:Class="DhirenBhai_sApp.Views.StoresPage" Title="Stores">
<ContentPage.Content>
    <StackLayout>
        <StackLayout VerticalOptions="Start" BackgroundColor="LawnGreen" HeightRequest="40">
            <Label Text="Stores" TextColor="White" VerticalOptions="Center" HorizontalOptions="Center" FontSize="Large" />
        </StackLayout>
        <Frame VerticalOptions="FillAndExpand" Margin="10" BackgroundColor="Transparent" Padding="5" >
            <StackLayout VerticalOptions="FillAndExpand">
                <Label TextColor="Black" HorizontalOptions="CenterAndExpand" Text="Stores" />
                <Label TextColor="Black" HorizontalOptions="CenterAndExpand" Text="You don't have to worry about your money being stolen from online attacks." ></Label>
                <Label TextColor="Black" HorizontalOptions="CenterAndExpand" Text="You now have the option to save your money offline, by your using a device."></Label>
                <Label TextColor="Black" HorizontalOptions="CenterAndExpand" Text="Register and find out more about the offline storage device from service provider"></Label>
                <Button Text="Register" BackgroundColor="LawnGreen" Margin="5"  BorderWidth="50" TextColor="White" VerticalOptions="End" ></Button>
            </StackLayout>
        </Frame>
    </StackLayout>
</ContentPage.Content>


注意: - 框架只包含一个孩子,这就是为什么你必须采用另一种布局来包含所有标签和按钮