GridLayout from support library does not show 2 rows on Android 2, onChildVisibilityChanged Error

后端 未结 1 1581
鱼传尺愫
鱼传尺愫 2021-02-06 00:37

Has anybody gotten the support library to render a grid layout correctly in Android 2? Instead of 2 rows and columns I get a single row on the screen and see this error in the

相关标签:
1条回答
  • 2021-02-06 00:53

    I guess you missed to add XML namespace. Please correct it in this way:

    <android.support.v7.widget.GridLayout 
         xmlns:grid="http://schemas.android.com/apk/res-auto"
         xmlns:android="http://schemas.android.com/apk/res/android">
    ...
    </android.support.v7.widget.GridLayout>
    

    and don't forget to prefix attributes used by compatibility GridLayout with XML namespace too:

    <ImageButton android:id="@+id/btnSentence"
        grid:layout_row="0"
        grid:layout_column="0"
        ...
    />
    

    Hope it helps...

    0 讨论(0)
提交回复
热议问题