2017-01-17 5 views
1

나는 MM에서 문제없이 작동하는 키보드를 개발했습니다. Nougat에서 레이아웃 문제가있는 경우 더 잘 이해하려면이 이미지를 확인하십시오 : http://imgur.com/a/IHfeZ.Nougat의 Android 키보드, 사용자 정의 팝업

첫 번째 이미지는 누우 가트입니다 (팝업이 완전히 표시되지 않음). 둘째는 MM에 표시되는 것과 같습니다 (모든 라인이 올바르게 표시됨). 당신은 문제가 키보드 외부에 보여되지 팝업의 위치로 인해 발생 볼 수 있듯이

<?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>

:

나는 팝업을 사용자 정의하기 위해 XML을 사용했다. 이 문제를 어떻게 해결할 수 있습니까? 미리 감사드립니다.

+0

문제를 해결합니까? 나는 똑같은 문제를 겪고있다. :에스 – DaniG

답변

0

@ 레이아웃/미리보기는 어떤 모양입니까?

내 이론은 안드로이드 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에서 높이로 연주 해보십시오. 그들을 수동 높이로 설정하고 상황이 그에 따라 변경되는지 확인하십시오!