2017-03-02 23 views
5

私はXamarin.Formsチャットアプリケーションを作成しようとしていました。 問題は次のとおりです。Androidでは、キーボードが表示されるとすぐに、アクションバーを含むページ全体が上に移動します。私はIOSの問題をページのサイズを変更するNuGetパッケージを使って修正することができました。XamarinフォームAndroidキーボードがページ全体を上に移動

AndroidプロジェクトのMainActivity.csにすでにWindowSoftInputMode = Android.Views.SoftInput.AdjustResizeを設定しようとしましたが、動作しませんでした。 画面サイズを再計算して手動でページのサイズを変更しようとしましたが、別のデバイスで正確な計算のためにキーボードサイズを取得するソリューションが見つかりませんでした。

誰も以前に同じ問題があったのですか? サポートされているすべてのプラットフォーム用の正式なXamarin.Formsソリューションはありますか?

これは、これまで私のチャットのレイアウトです:事前に

<ContentPage.Content> 
<StackLayout Padding="0"> 
    <ScrollView> 
    <ListView HasUnevenRows="true" x:Name="lvChat" > 
     <ListView.ItemTemplate> 
     <DataTemplate> 
      <ViewCell> 
      <StackLayout Orientation="Vertical" VerticalOptions="Fill" HorizontalOptions="Fill" Padding="5"> 


       <Label Text="{Binding Author, StringFormat='{0}: '}" TextColor="Navy" FontSize="14" /> 
       <Label Text="{Binding Text}" TextColor="Black" FontSize="15" /> 
       <Label Text="{Binding Time}" TextColor="Black" FontSize="14" /> 
       <!-- Format for time.. , StringFormat='{0:HH:mm}' --> 

      </StackLayout> 
      </ViewCell> 
     </DataTemplate> 
     </ListView.ItemTemplate> 
    </ListView> 
    </ScrollView> 


    <StackLayout Orientation="Horizontal" Padding="0" Margin="5, 5, 5, 5"> 
    <Entry Keyboard="Chat" x:Name="tbxChatInput" HorizontalOptions="FillAndExpand" Placeholder="Send a Message..." /> 
    <Button x:Name="btnSendMsg" HorizontalOptions="End" Text="Send" Margin="5"/> 

    </StackLayout> 
</StackLayout> 

ありがとう!

答えて

0

例えばAndroidマニフェストでwindowSoftInputModeを設定してみてください:

<application ... > 
    <activity 
     android:windowSoftInputMode="adjustResize" ... > 
     ... 
    </activity> 
    ... 
</application> 
1

こんにちは、あなたの入力が含まれているstacklayoutを入れてみてください、あなたはそれがキーボードを押し上げる入力をタップしたときに、scrollviewの内側にそのようにボタンを送信あなたの入力を示し、残りのチャットはiOSとAndroidで正常に動作します。試してみてください:

<ContentPage.Content> 
     <StackLayout Padding="0"> 
      <ScrollView> 

      <StackLayout> 

      <ListView HasUnevenRows="true" x:Name="lvChat" > 
       <ListView.ItemTemplate> 
        <DataTemplate> 
         <ViewCell> 
         <StackLayout Orientation="Vertical" VerticalOptions="Fill" HorizontalOptions="Fill" Padding="5"> 


         <Label Text="{Binding Author, StringFormat='{0}: '}" TextColor="Navy" FontSize="14" /> 
         <Label Text="{Binding Text}" TextColor="Black" FontSize="15" /> 
         <Label Text="{Binding Time}" TextColor="Black" FontSize="14" /> 
        <!-- Format for time.. , StringFormat='{0:HH:mm}' --> 

       </StackLayout> 
       </ViewCell> 
      </DataTemplate> 
      </ListView.ItemTemplate> 
     </ListView> 

     <StackLayout Orientation="Horizontal" Padding="0" Margin="5, 5, 5, 5"> 
     <Entry Keyboard="Chat" x:Name="tbxChatInput" HorizontalOptions="FillAndExpand" Placeholder="Send a Message..." /> 
     <Button x:Name="btnSendMsg" HorizontalOptions="End" Text="Send" Margin="5"/> 
     </StackLayout> 

     </StackLayout> 

     </ScrollView> 
    </StackLayout> 
    </ContentPage.Content> 
関連する問題