Kit*_*tto 10 xamarin xamarin.forms
我正在使用Xamarin.Forms
并且正在瞄准iOS
和Android
.
XAML
<?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="XilnexOTM.Views.LoginPage"
BackgroundImage="bg1.png" >
<ScrollView>
<StackLayout Orientation="Vertical">
<Label Text="PICTURE" />
<Label Text="PIC 2" />
<Entry Placeholder="Username" />
<Entry Placeholder="Password" IsPassword="true"/>
<Button x:Name="btn_Login"
Text="Login"
BackgroundColor="#FF0000"/>
</StackLayout>
</ScrollView>
</ContentPage>
Run Code Online (Sandbox Code Playgroud)
是否有任何可能的方法将概念CSS
应用于Xamarin.Forms
?
xx {
background-size: cover;
background-position: right bottom;
}
Run Code Online (Sandbox Code Playgroud)
Dan*_*rda 21
用ContentPage.BackgroundImage
你无法控制纵横比.而是使用Image
结合AbsoluteLayout
(和设置Aspect
属性Image
):
<?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="XilnexOTM.Views.LoginPage">
<AbsoluteLayout VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand">
<Image AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
Source="bg1.png" Aspect="AspectFill"/>
<ScrollView AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0, 0, 1, 1">
<StackLayout Orientation="Vertical">
<Label Text="PICTURE" />
<Label Text="PIC 2" />
<Entry Placeholder="Username" />
<Entry Placeholder="Password" IsPassword="true"/>
<Button x:Name="btn_Login"
Text="Login"
BackgroundColor="#FF0000"/>
</StackLayout>
</ScrollView>
</AbsoluteLayout>
</ContentPage>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
7921 次 |
最近记录: |