的IntelliJ:获取网格布局工作 [英] IntelliJ: Getting GridLayout work

查看:238
本文介绍了的IntelliJ:获取网格布局工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试着在我的应用程序使用网格布局,但它不会工作。
我用这个教程:<一href=\"http://stackoverflow.com/questions/12468606/intellij-and-android-support-v7-widget-gridlayout\">IntelliJ和android.support.v7.widget.GridLayout

但它仍然无法工作。

我收到以下错误:

 错误:没有在包'机器人'发现属性列数资源标识符
错误:没有在包'机器人'发现属性rowCount等资源标识符

任何进一步的提示吗?

编辑:
与我的实际XML的:

 &LT;?XML版本=1.0编码=UTF-8&GT?;&LT; LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
              的xmlns:格=htt​​p://schemas.android.com/apk/res-auto
              机器人:layout_width =350dp
              机器人:layout_height =FILL_PARENT
              机器人:方向=垂直&GT;    &LT; EditText上的android:layout_height =WRAP_CONTENT
              机器人:layout_width =FILL_PARENT
              机器人:cursorVisible =假
              机器人:ID =@ + ID / txtName的/&GT;
    &LT; android.support.v7.widget.GridLayout
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =FILL_PARENT
            格:列数=3
            格:rowCount等=2&GT;        &LT;的TextView
                机器人:layout_width =WRAP_CONTENT
                机器人:layout_height =WRAP_CONTENT
                机器人:文字=1,1/&GT;
    
    &LT; /android.support.v7.widget.GridLayout>&LT; / LinearLayout中&GT;


解决方案

今天,我挣扎着这一点,并在 Android开发人员网站我找到简单的解决方案,以及为什么他们与它的问题。从V7库网格布局不与V7应用程序兼容性库连接,所以你必须手动添加V7网格布局库的依赖。

如果您使用gradle这个再的build.gradle 只是添加

  {相关性
    ...
    编译com.android.support:gridlayout-v7:18.0.+
}

和一切都应该工作正常:)

I try to use GridLayout in my App, but it wont work. I used this Tutorial: IntelliJ and android.support.v7.widget.GridLayout

But it still wont work.

I get the following Error:

error: No resource identifier found for attribute 'columnCount' in package 'android'
error: No resource identifier found for attribute 'rowCount' in package 'android'

Any further tips?

EDIT: work with my actual XML:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:grid="http://schemas.android.com/apk/res-auto"
              android:layout_width="350dp"
              android:layout_height="fill_parent"
              android:orientation="vertical">

    <EditText android:layout_height="wrap_content"
              android:layout_width="fill_parent"
              android:cursorVisible="false"
              android:id="@+id/txtName"/>


    <android.support.v7.widget.GridLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            grid:columnCount="3"
            grid:rowCount="2">

        <TextView   
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="1,1" />
     
    </android.support.v7.widget.GridLayout>

</LinearLayout>

解决方案

Today I struggled with this and on android dev site I found simpler solution and why they're problems with it. GridLayout from v7 libraries aren't connected with v7 appcompat library so you must add v7 gridlayout library dependency manually.

If you use gradle then in build.gradle just add

dependencies {
    ...
    compile 'com.android.support:gridlayout-v7:18.0.+'
}

and everything should works fine :)

这篇关于的IntelliJ:获取网格布局工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆