2017-11-19 20 views
1

27x27 GridLayout을 디자인하고 싶습니다. 표의 모든 셀에는 단 하나의 문자 만 포함됩니다. GridLayout을 가능한 크게 만들기 위해, GridLayout을 화면의 위아래로 (가로 방향으로) 제한합니다. 가독성을 최적화하기 위해 TextViews에서 "자동 크기 조정"을 사용합니다. 가로 방향에서 "넥서스 10", "픽셀 C"와 "넥서스 9"에뮬레이터에서이 레이아웃 올바르게 표시 안드로이드 스튜디오 3.0을 사용하여"자동 크기 조정"이 작은 TextViews에서 작동하지 않는 것 같습니다.

<?xml version="1.0" encoding="utf-8"?> 
<android.support.constraint.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/SCFrame" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:layout_marginTop="?attr/actionBarSize" 
tools:layout_behavior="@string/appbar_scrolling_view_behavior" 
> 

<android.support.v7.widget.GridLayout 
    android:id="@+id/SudokuGrid" 
    android:layout_width="0dp" 
    android:layout_height="0dp" 
    android:tag="SudokuGrid" 
    app:layout_constraintDimensionRatio="1:1" 
    app:layout_constraintLeft_toLeftOf="parent" 
    app:layout_constraintTop_toTopOf="parent" 
    app:layout_constraintBottom_toBottomOf="parent" 
    > 


    <android.support.v7.widget.AppCompatTextView 
     android:id="@+id/A11" 
     android:gravity="center" 
     android:text="1" 
     app:autoSizeMinTextSize="5sp" 
     app:autoSizeStepGranularity="1sp" 
     app:autoSizeTextType="uniform" 
     app:layout_column="0" 
     app:layout_columnWeight="1" 
     app:layout_row="0" 
     app:layout_rowWeight="1" /> 

    <android.support.v7.widget.AppCompatTextView 
     android:id="@+id/A12" 
     android:gravity="center" 
     android:text="2" 
     app:autoSizeMinTextSize="5sp" 
     app:autoSizeStepGranularity="1sp" 
     app:autoSizeTextType="uniform" 
     app:layout_column="1" 
     app:layout_columnWeight="1" 
     app:layout_row="0" 
     app:layout_rowWeight="1" /> 

... repeat this for 27 columns and 27 rows in total; 
you just need to complete the first line and the first column to be able to reproduce the problem 

. 그러나 다른 모든 에뮬레이터에서는 실패합니다. 높이의 취급이 문제가되는 것 같습니다. 왜 그런가?

답변