2017-12-07 10 views
0

私はXamarin Formsの最新バージョンを使用しています。私はコンテンツページを持っています。コンテンツページには、画像と入力の入力といくつかのボタンを含むスタックレイアウトがあるスクロールビューを持つグリッドがあります。入力をタッチしてテキストを入力すると、キーボードがボタンを覆い、ボタンを押すことができません。これはスクロール可能ではありません。理由はわかりません。誰も私を助けることができますか?ここでXamarinフォーム:KeyBoardを使用したScrollView

は私の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="Spirocco.LoginPage"> 
<Grid> 
    <ScrollView Orientation="Both" x:Name="scrollView"> 
     <ScrollView.Content> 
      <StackLayout BackgroundColor="#302138"> 
       <Image Source="login_logo" Margin="0,0,0,0"></Image> 
       <StackLayout BackgroundColor="White" Margin="20,0,20,30"> 
        <Label Text="ÜDVÖZÖLJÜK!" FontSize="30" FontFamily="Comic Sans MS" Margin="0,15,0,0" TextColor="#302138" HorizontalTextAlignment="Center"></Label> 
        <Entry Text="{Binding Email}" Placeholder="E-mail" Margin="40,0,40,0" Keyboard="Email"/> 
        <Entry Text="{Binding Password}" Placeholder="Jelszó" IsPassword="True" Margin="40,0,40,0"/> 
        <Button Text="BEJELENTKEZÉS" Clicked="Login" TextColor="White" BackgroundColor="#302138" Margin="40,10,40,0"/> 
        <Button Text="REGISZTRÁCIÓ" Clicked="Register" TextColor="White" BackgroundColor="#302138" Margin="40,0,40,25"/> 
       </StackLayout> 
      </StackLayout> 
     </ScrollView.Content> 
    </ScrollView> 
</Grid> 

Here is the solution

+0

あなたがスクロールすることは何をしたいですか? 今、グリッド内のすべてがスクロールしたいものです。要素内の要素は、スクロール可能ではなく、互いに重なり合うことができます。 – Neepsnikeep

+0

全ページをスクロール可能にしたい。パスワードを入力しようとすると、キーボードがそれをカバーしていたのでログインボタンに触れません。私はすべてのコンテンツを下にスクロールして、ログインボタンに触れることができます。 Sry私の英語は良いことではありません。 – totesz09

+0

' ...'を ' ...'に置き換えるだけでいいと思います。グリッドは、ビューポートのサイズに関係なく、必要な大きさにすることができます。しかし、ContentPageは** direct **子がScrollViewのときに何をすべきかを知っています。 私はこれをテストすることができないので、回答として投稿しません。 – Neepsnikeep

答えて

0

The Solution is Here

stacklayoutに十分なコンテンツを持っていないので、それはスクロールできませんでした:

はこれを試してみてください。 これを行うことができました。これは非常に素晴らしい解決策ではありませんが、機能します。 私は、パスワードHeighRequestと同じ色をStackLayoutで置き、パスワードを入力するとページがスクロール可能になりました。

<?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="Spirocco.LoginPage"> 
<ContentPage.Content> 
    <ScrollView Orientation="Both" x:Name="scrollView"> 
     <ScrollView.Content> 
      <StackLayout BackgroundColor="#302138"> 
       <Image Source="login_logo" Margin="0,0,0,0"></Image> 
       <StackLayout BackgroundColor="White" Margin="20,0,20,30"> 
        <Label Text="ÜDVÖZÖLJÜK!" FontSize="30" FontFamily="Comic Sans MS" Margin="0,15,0,0" TextColor="#302138" HorizontalTextAlignment="Center"></Label> 
        <Entry Text="{Binding Email}" Placeholder="E-mail" Margin="40,0,40,0" Keyboard="Email"/> 
        <Entry Text="{Binding Password}" Placeholder="Jelszó" IsPassword="True" Margin="40,0,40,0"/> 
        <Button Text="BEJELENTKEZÉS" Clicked="Login" TextColor="White" BackgroundColor="#302138" Margin="40,10,40,0"/> 
        <Button Text="REGISZTRÁCIÓ" Clicked="Register" TextColor="White" BackgroundColor="#302138" Margin="40,0,40,25"/> 
       </StackLayout> 
       <Label BackgroundColor="#302138" HeightRequest="160"/> 
      </StackLayout> 
     </ScrollView.Content> 
    </ScrollView> 
</ContentPage.Content> 

+0

誰かもっとうまく解決していますか? – totesz09

0

、グリッドの行の高さの値は次のようになります「*」に等しく、したがって、画面内のすべてのスペースを取ります。これがスクロール可能でない理由です。

ところで、私はなぜあなたがグリッドに入れ子になっているのかは分かりません。

<?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="Spirocco.LoginPage"> 

<ScrollView Orientation="Both" x:Name="scrollView"> 
    <ScrollView.Content> 
     <StackLayout BackgroundColor="#302138"> 
      <Image Source="login_logo" Margin="0,0,0,0"></Image> 
      <StackLayout BackgroundColor="White" Margin="20,0,20,30"> 
       <Label Text="ÜDVÖZÖLJÜK!" FontSize="30" FontFamily="Comic Sans MS" Margin="0,15,0,0" TextColor="#302138" HorizontalTextAlignment="Center"></Label> 
       <Entry Text="{Binding Email}" Placeholder="E-mail" Margin="40,0,40,0" Keyboard="Email"/> 
       <Entry Text="{Binding Password}" Placeholder="Jelszó" IsPassword="True" Margin="40,0,40,0"/> 
       <Button Text="BEJELENTKEZÉS" Clicked="Login" TextColor="White" BackgroundColor="#302138" Margin="40,10,40,0"/> 
       <Button Text="REGISZTRÁCIÓ" Clicked="Register" TextColor="White" BackgroundColor="#302138" Margin="40,0,40,25"/> 
      </StackLayout> 
     </StackLayout> 
    </ScrollView.Content> 
</ScrollView> 
+0

ScrollViewには親が必要です。または、SequentにNo Matching Element Errorが含まれています。 – totesz09

関連する問題