Android Studio 3.1.4 gridlayout v7:28无法呈现

时间:2018-09-05 22:17:13

标签: android android-studio android-gridlayout

enter image description here我正在尝试使用GridLayout,但是我遇到的问题是,当我将图像放入网格内时,它仅在网格内显示一个小点,尝试使用鼠标但不起作用,还尝试将图像布局的宽度和高度调整为150dp并仍然看到相同的斑点...尝试在我的设备上运行它,但失败:错误:此消息格式不正确(无效令牌):

Message{kind=ERROR, text=error: not well-formed (invalid token)., sources=[C:\Users\Edgar\AndroidStudioProjects\SouthparkCharactersGrid\app\src\main\res\layout\activity_main.xml:25], original message=, tool name=Optional.of(AAPT)}

该图像在网格外部运行良好,并且与其他任何默认的android图像(按钮也一样)发生了什么……

这些是我的XML代码:

<?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:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity"
    tools:layout_editor_absoluteY="81dp">

    <android.support.v7.widget.GridLayout
        android:id="@+id/gridLayout2"
        android:layout_width="368dp"
        android:layout_height="274dp"
        app:columnCount="2"
        app:rowCount="2"
        tools:layout_editor_absoluteX="8dp"
        tools:layout_editor_absoluteY="205dp">

        <ImageView
            android:id="@+id/imageView14"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:srcCompat="@drawable/kyle" />
    </android.support.v7.widget.GridLayout>

</android.support.constraint.ConstraintLayout>

1 个答案:

答案 0 :(得分:0)

已解决,将顶部和底部的“ android.support.v7.widget.GridLayout”替换为“ GridLayout”,并使其正常工作