Android v7 GridLayout

Ash*_*Ash 2 android-widget android-layout

当我将v7 GridLayout放入线性布局时,我不断收到此错误:

找到标记android.support.v7.widget.GridLayout的意外名称空间前缀"xmlns"

如果我没有在线性或相对布局中的GridLayout,那么它将工作正常,但我必须在某种布局中使用GridLayout,所以滚动可以工作,但我不断得到上面的错误?

有人知道要防止在布局中发生这种情况吗?

谢谢你的帮助.

Jör*_*örg 5

我认为这是Lint的一个已知问题:http://code.google.com/p/android/issues/detail?id = 52831.

只需将工具:ignore ="MissingPrefix"添加到Gridlayout项:

<android.support.v7.widget.GridLayout
...
tools:ignore="MissingPrefix">
Run Code Online (Sandbox Code Playgroud)

为了能够使用此命名空间,请确保将其包含在根标记中:

xmlns:tools="http://schemas.android.com/tools"
Run Code Online (Sandbox Code Playgroud)