GridLayout 是在 Android API Level 14 加进来的

它可用来取代 TableLayout

也提供了自由度较大且实用的排版功能

为了兼容 4.0 以下的较低版本

Android 提供了 android.support.v7.widget.GridLayout 这个 libuary

当使用 xml 档做画面排版的时候

如果是使用 android.support.v7.widget.GridLayout

有一些属性需要使用 app 这个 name space


app:orientation
app:columnCount
app:rowCount
app:alignmentMode
app:useDefaultMargins
app:columnOrderPreserved
app:rowOrderPreserved

但是问题来了

即使加上 name space 宣告


xmlns:app="http://schemas.android.com/apk/res/专案package"

Lint 还是会报错

Unexpected namespace prefix "app" found for tag android.support.v7.widget.GridLayout

这该如何是好?

找了一下解决方法,最后发现只要告诉 Lint 忽略这个问题就好了

xmlns:tools="http://schemas.android.com/tools"
tools:ignore="MissingPrefix"