2017-11-28 20 views
0

[Xamarin.Forms 2.5.0.91635] [안드로이드 5,6,7,8]Xamarin.Forms : 소프트 키보드가 페이지의 맨 아래에있는 마지막 항목을 (스크롤 할 때) 중복

한 페이지를 가지고있는 입력 항목과 레이블을 포함하는 listview가 있습니다. 내 문제는 안드로이드에서 첫 번째 또는 두 번째 항목을 누르면 키보드가 나타납니다. 마지막 항목을 선택하기 위해 페이지를 아래로 스크롤하고 싶지만 소프트 키보드로 겹쳐서 마지막 항목을 볼 수 없습니다. 소프트 키보드가 마지막 엔트리를 숨기기 때문에 소프트 키보드가 활성화/표시되면 마지막 항목으로 스크롤 할 수 없습니다. 소프트 키보드를 숨기거나 비활성화 할 때 마지막 항목으로 스크롤 할 수 있지만이 기능은 필요하지 않습니다!

인터넷에서 검색해 봤지만 아무것도 시도하지 않았습니다. 여기 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