2017-01-17 16 views
1

私はMMで問題なく動作するキーボードを開発しました。ところでノーガットにはレイアウトの問題がありますので、このイメージをよく理解してください:http://imgur.com/a/IHfeZNougatのAndroidキーボード、カスタムポップアウト

第1の画像はノーガット(ポップアップは完全に表示されません)です。第2の画像はMMに表示されるようです(すべての線が正しく表示されます)。

私はポップアップをカスタマイズするには、このXMLを使用:

<?xml version="1.0" encoding="utf-8"?> 
 
<LinearLayout 
 
    xmlns:android="http://schemas.android.com/apk/res/android" 
 
    android:layout_width="match_parent" 
 
    android:layout_height="wrap_content" 
 
    android:orientation="horizontal" 
 
    android:background="@color/aosp_pressed"> 
 
    <android.inputmethodservice.KeyboardView 
 
     android:layout_gravity="bottom" 
 
     android:id="@android:id/keyboardView" 
 
     android:layout_width="match_parent" 
 
     android:layout_height="wrap_content" 
 
     android:keyPreviewLayout="@layout/preview" 
 
     android:keyBackground="@drawable/key_background" 
 
     android:keyTextColor="#fff" 
 
     android:background="@color/aosp_background" 
 
     android:keyTextSize="25sp"/> 
 
    <ImageButton android:id="@android:id/closeButton" 
 
     android:background="@color/aosp_pressed" 
 
     android:layout_width="wrap_content" 
 
     android:layout_height="wrap_content" 
 
     android:layout_gravity="center" 
 
     android:layout_marginStart="8dp" 
 
     android:layout_marginEnd="8dp" 
 
     android:clickable="true" 
 
     android:src="@drawable/ic_close_black" /> 
 
</LinearLayout>

あなたは問題がキーボードの外にあったされていないポップアップの位置によって引き起こされる見ることができるように。どうすればこの問題を解決できますか? おかげさまで皆に感謝します。

+0

問題を修正しますか?私は同じ問題を抱えています。 :s – DaniG

答えて

0

あなたの@レイアウト/プレビューはどのようなものですか?

私の理論は、Android 6と7の間で、wrap_contentがサイズを変更したときの時間です。

<LinearLayout 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_horizontal"> 

      <TextView 
       android:id="@+id/xxxxx" 
       android:layout_width="0dp" 
       android:layout_height="wrap_content" 
       android:layout_weight="1"> 
</LinearLayout> //PARTIAL CODE! 

を使用している場合6.0には問題はなかったの前に。テキストビューは、テキストに合わせて展開され、中央に配置されます。

しかし、7では、テキストが完全に垂直に表示され、最初のLinearLayoutが幅0に設定され、調整されていないことが示唆されます。

@ layout/preview、またはcloseButtonの高さで遊んでみてください。手動の高さに設定し、それに応じて変化するかどうかを確認してください。

関連する問題