2017-11-28 14 views
0

の下部にある最後のエントリ(スクロール)と重なる[Xamarin.Forms 2.5.0.91635] [アンドロイド5,6,7,8-]Xamarin.Forms:ソフトキーボードページ

Iは、ページを持っています入力項目とラベルを含むリストビューがあります。私の問題は、Androidでは、最初または2番目のエントリをタップすると、キーボードが表示されます。最後のエントリを選択するためにページを下にスクロールしたいのですが、ソフトキーボードでオーバーラップしているため、最後のエントリを表示(またはフォーカス)できません。ソフトキーボードが最後のエントリを隠すので、ソフトキーボードが有効/表示されているときに最後のエントリまでスクロールできません。 ソフトキーボードを隠す/無効にすると最後の項目にスクロールすることができますが、これは嫌です!

インターネットで検索してみましたが、何もうまくいきませんでした。動作しませんでした

ソリューション: https://gist.github.com/jimmgarrido/e36033b26f01e8da091fd321d41d991a xamarinformscorner.blogspot.nl/2016/06/soft-keyboard-hiding-entries-fields-in.html https://forums.xamarin.com/discussion/62668/appcompat-does-not-resize-screen-with-keyboard

<ContentPage.Content> 
     <ScrollView> 
       <StackLayout x:Name="StackLayoutButtons" HorizontalOptions="Center" Orientation="Horizontal"> 
        <Button x:Name="PreviousButton" WidthRequest="35" FontSize="23" FontAttributes="Bold" Clicked="PreviousButton_OnClicked"></Button> 
        <Button x:Name="DatePickerButton" FontSize="20" Clicked="DatePickerButton_OnClicked"></Button> 
        <DatePicker x:Name="DatePicker" Format="dddd d MMMM yyyy" VerticalOptions="Center" HorizontalOptions="FillAndExpand" IsVisible="False" IsEnabled="False"/> 
        <Button x:Name="NextButton" WidthRequest="35" FontSize="23" FontAttributes="Bold" Clicked="NextButton_OnClicked"></Button> 
        <Button x:Name="LastButton" WidthRequest="50" FontSize="23" FontAttributes="Bold" Clicked="LastButton_OnClicked"></Button> 
       </StackLayout> 

       <ListView x:Name="ListViewItemPage" ItemTapped="ListView_OnItemTapped"> 
        <ListView.ItemTemplate> 
         <DataTemplate> 
          <ViewCell> 
           <RelativeLayout x:Name="RelativeLayout" > 
            <Label x:Name="DescriptionLabel" Text="{Binding Description}" RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Y, Factor=0, Constant=15}" RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=X, Factor=0, Constant=15}" /> 
            <Entry x:Name="Entry" WidthRequest="85" Keyboard="Text" HorizontalTextAlignment="Start" FontSize="19" HorizontalOptions="Center" VerticalOptions="Center" Text="{Binding Value, Mode=TwoWay, Converter={StaticResource FloatValueConverter}}" Unfocused="ValueEntry_OnUnfocused" 
              RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Y, Factor=0, Constant=10}" RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1, Constant={StaticResource ConstantMultiPlatform}}" > 
             <Entry.HeightRequest> 
              <OnPlatform x:TypeArguments="x:Double"> 
               <On Platform="iOS" Value="28"></On> 
               <On Platform="Android" Value="42"></On> 
               <On Platform="UWP" Value="32"></On> 
              </OnPlatform> 
             </Entry.HeightRequest> 
            </Entry> 
           </RelativeLayout> 
          </ViewCell> 
         </DataTemplate> 
        </ListView.ItemTemplate> 
       </ListView> 
      </StackLayout> 
     </ScrollView> 
    </ContentPage.Content> 

Normal view (last entry) When first entry focused and scrolled all the way down

たぶんここで誰かがこのバグの作業溶液/回避策を持っていますか?

+0

https://stackoverflow.com/questions/31172518/how-do-i-keepキーボードのサイズを変更する代わりにキーボードを使用するhttps://stackoverflow.com/questions/34863615/dynamically-move-entry-xamarin-forms?rq=1 – Dan

答えて

0

次のように "WindowSoftInputMode = SoftInput.AdjustResize" あなたのドロイドプロジェクトでMainActivityを開き、追加してみてください。

[Activity(
    Label = "Sample", 
    Icon = "@drawable/icon", 
    Theme = "@style/MyTheme", 
    MainLauncher = true, 
    WindowSoftInputMode = SoftInput.AdjustResize, 
    ScreenOrientation = ScreenOrientation.Portrait, 
    ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] 
    public class MainActivity.... 
    { 
     ... 
    } 
+0

ありがとうございます動作しません。私はすでにSoftInput.AdjustResizeとSoftInput.AdjustPanを使っています。これらのプロパティは動作しません。 – E75

+0

@ E75もう一つの回避策(かなり醜いところで)は、BackgroundColor = "Transparent"でScrollViewを閉じる前にBoxViewを追加し、コードビハインドではエントリがフォーカスされているときの高さを変更します。 – FabriBertani