2016-06-01 26 views
0

こんにちはみんなを動作していないXamarinの専門家のための非常に簡単な質問は、私が垂直中央整列stacklayoutコントロールしようとしていますし、それがモバイルデバイスをアンドロイド携帯で細かい作業が、Windowsで動作していません。添付画像を見て、私を助けてください詳細については私のコードは、私はWindowsの携帯電話のために画面の中央に位置を合わせだろうかXamarin Stacklayout VerticalOptions CenterAndExpandはおそらく

<?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="aa.Views.MainPage"> 
    <ScrollView> 
    <StackLayout Orientation="Vertical" VerticalOptions="CenterAndExpand" 
        Padding="20" Spacing="10"> 
     <Entry x:Name="enEmail" Placeholder="Email"></Entry> 
     <Entry x:Name="enPassword" IsPassword="True" Placeholder="Password"></Entry> 
     <Button Text="Login" Clicked="OnClicked_btnLogin" x:Name="btnLogin"></Button> 
     <Button Text="Register" Clicked="OnClicked_btnRegister" x:Name="btnRegister"></Button> 
    </StackLayout> 
    </ScrollView> 

</ContentPage> 

を下回っている

enter image description here

+0

はこれです中央に配置されますあなたのページにあなたが持っている唯一のコード? –

+0

問題@AtulChaudharyは、スクロールビューです。削除して、試してみてください。@ AtulChaudhary –

+0

それが働いていたが、私は、テキストボックスをクリックしたときに私がscrillview –

答えて

1

そのStackLayout:プットビューが連続しています。あなたの代わりのように下側の使用Gridにボタンを移動したい場合:以下のコードを試してみてください

<Grid RowSpacing="10"><!--RowSpacing gives some space between rows--> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="Auto"/> <!--You can also use constant size also--> 
     <RowDefinition Height="Auto"/> 
     <RowDefinition Height="*"/> <!--This fill the empty space--> 
     <RowDefinition Height="Auto"/> 
     <RowDefinition Height="Auto"/> 
    </Grid.RowDefinitions> 

    <Entry Grid.Row="0" Placeholder=" Email"/> 
    <Entry Grid.Row="1" Placeholder=" Password" IsPassword="True"/> 

    <Button Grid.Row="3" Text="Login" /> 
    <Button Grid.Row="4" Text="Register" /> 

    </Grid> 
+0

android –

+0

あなたの努力のためにあなたを投票しましたが、私はまだ答えを探しています –

1

、それはあなたのスクロールビューを与えるプラスあなたのフィールドは

<ScrollView> 
     <AbsoluteLayout> 
     <StackLayout Orientation="Vertical" AbsoluteLayout.LayoutBounds="0, 0, 1, 1" AbsoluteLayout.LayoutFlags="All" x:Name="maincontent" Spacing="0"> 
      <StackLayout Orientation="Vertical" VerticalOptions="CenterAndExpand" 
        Padding="20" Spacing="10"> 
      <Entry x:Name="enEmail" Placeholder="Email"></Entry> 
      <Entry x:Name="enPassword" IsPassword="True" Placeholder="Password"></Entry> 
      <Button Text="Login" Clicked="OnClicked_btnLogin" x:Name="btnLogin"></Button> 
      <Button Text="Register" Clicked="OnClicked_btnRegister" x:Name="btnRegister"></Button> 
      </StackLayout> 
     </StackLayout> 
     </AbsoluteLayout> 
    </ScrollView> 
+0

scrollviewはこの考え方が好きですが、この構文では動作しません –

+0

画面が空き領域を使い果たした場合に動作します。@ AtulChaudhary –

+0

スペースエントリコントロールをクリックしてから、私はあなたの努力のためにあなたを投票 –

関連する問題