android.support.v7.widget.GridLayout无法得到它的工作 [英] android.support.v7.widget.GridLayout cannot get it to work
问题描述
我有一个Android项目,它利用网格布局在大部分菜单和屏幕。然而问题是,GridLayout的从API 14和起支撑。
I have an android project which utilizes GridLayout in most of its menus and screens. The problem however is that GridLayout is supported from API 14 and onwards.
因为我想提供给Android的旧版本的应用程序,以及,我试图使用Android的自己的支持库<一href="http://developer.android.com/reference/android/support/v7/widget/GridLayout.html">GridLayout这将增加最多支持的API 7。 而这,正是我一直在寻找,但我不能为我的生命得到它的工作。我已经尝试了所有这些解释和思想的:
Since I want to make the application available to older version of android as well, I tried to use Android's own Support Library GridLayout which adds support up to API 7. This was exactly what I was looking for, however I cannot for the life of me get it to work. I have tried all of these explanations and ideas:
- Android's official instructions
- Solution 1
- Solution 2
- Solution 3
- Solution 4
- Solution 5
和更多...
无论我做什么,我该怎么做,或我使用(无论是Eclipse的ADT或Android工作室),它总是给我一个错误在沿着线路布局XML什么IDE:
No matter what I do, how I do it or what IDE I use (whether Eclipse ADT or Android Studio), it always gives me an error in the Layout XML along the lines of:
The following classes could be instantiated: - android.support.v7.widget.GridLayout
With either one of these exceptions showing in the error log:
1. android.content.res.Resources$NotFoundException: Could not resolve value 0x7F080000
2. java.lang.classnotfoundexception: android.support.v7.gridlayout.R$dimen
编辑:供参考,这是我用什么来创建支持网格布局(直接从Android示例程序取):
For reference this is what I'm using to create the support gridlayout (taken directly from the android sample programs):
<android.support.v7.widget.GridLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/blue"
android:padding="10dip"
app:columnCount="4"
>
<TextView
android:text="@string/string_test"
/>
<EditText
app:layout_gravity="fill_horizontal"
app:layout_column="0"
app:layout_columnSpan="4"
/>
<Button
android:text="@string/button_test"
app:layout_column="2"
/>
</android.support.v7.widget.GridLayout>
我能可能是做错了,没有上述解决方案的工作?是否有什么我失踪,也许有一个与我原来的code的一个问题?
What could I possibly be doing wrong that none of the above solutions work? Is there something I'm missing, maybe there's a problem with my original code?
任何帮助是pciated AP $ P $
Any help is appreciated
推荐答案
尝试使用摇篮,并在build.gradle文件的最后添加如下内容:
Try using gradle, and in your build.gradle file add the following section at the end:
dependencies {
compile 'com.android.support:gridlayout-v7:19.0.0'
compile 'com.android.support:appcompat-v7:+'
}
然后执行assembleDebug摇篮任务。
Then execute assembleDebug gradle task.
这篇关于android.support.v7.widget.GridLayout无法得到它的工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!