问题描述
我想将 GridLayout 添加到我的 android 项目中,该项目使用支持库 GridLayout v7.我找到了这个线程,但可能需要几步添加这个库在本段中没有提到在IntelliJ中设置支持GridLayout的库.
I want to add GridLayout into my android project which is use support library GridLayout v7. I found this thread but maybe a few steps of adding this library did not mention in this paragraph Set up support GridLayout library in IntelliJ.
谁能解释清楚?
我在 this 线程
推荐答案
现在给出答案已经晚了,但现在是这样,至少对于未来正在寻找如何为 添加支持库和资源的解决方案的人来说code>GridLayout(或 ActionBarActivity
/AppCompat
,见下文).
It's late for an answer but here it is, at least for future people looking for a solution on how to add the support library and resources for GridLayout
(or ActionBarActivity
/ AppCompat
, see below).
最简单的方法如下.
确保您已从 Android SDK 管理器安装 Android 支持库.
在IDEA中:打开你的项目,然后选择File
/Import Module
In IDEA: Open your project, then select File
/ Import Module
- 选择SDK下的目录:
{SDK}extrasandroidsupportv7gridlayout
- 选择
从外部模型导入模块
和Eclipse
- 然后您可以选择
在 .classpath 文件附近创建模块文件
,或者如果您不能/不想写入您的 SDK 路径,则选择将它们放在其他地方 - 在下一个屏幕中,您应该看到
Select Eclipse projects to import
和android-support-v7-gridlayout
,IDEA 还会要求您重新加载项目.莉> - 这应该在您的项目中添加一个模块
gridlayout [android-support-v7-gridlayout]
.
- select the directory under the SDK:
{SDK}extrasandroidsupportv7gridlayout
- select
Import module from external model
andEclipse
- you can then select
Create module files near .classpath files
, or choose to put them elsewhere if you can't / don't want to write into your SDK path - in the next screen you should see
Select Eclipse projects to import
andandroid-support-v7-gridlayout
, IDEA will also ask you to reload the project. - this should add a module
gridlayout [android-support-v7-gridlayout]
in your project.
现在您必须将项目依赖项更新到此模块的资源,并添加 .jar 库.选择File
/Project Structure
Now you have to update your project dependencies to this module for the resources, and add the .jar libraries. Select File
/ Project Structure
- 选择
Modules
项目设置,然后选择你的项目(下图中,testv7) - 选择右侧面板上的
Dependencies
- 使用
+
按钮(在右侧面板上)将Module 依赖项...
添加到android-support-v7-gridlayout
- 类似地,添加一个
Jars 或目录...
指向{SDK}extrasandroidsupportv7gridlayoutlibs
目录(或指向.jar 内).如果您也打算使用 v4,请选择{SDK}extrasandroidsupportv7appcompatlibs
,因为它包含 v4 和 v7 jars - 您的设置应如下所示:
- select the
Modules
project settings, and select your project (in the picture below, testv7) - select the
Dependencies
on the right panel - add with the
+
button (on the right panel) aModule dependency...
to theandroid-support-v7-gridlayout
- similarly, add a
Jars or directories...
pointing to the{SDK}extrasandroidsupportv7gridlayoutlibs
directory (or to the .jar within). If you intend to use the v4 as well, choose{SDK}extrasandroidsupportv7appcompatlibs
instead since it contains both v4 and v7 jars - your settings should look like this:
现在你应该没事了.
对我来说,这是解决 ActionBarActivity
类似问题的唯一方法,在 {SDK}extrasandroidsupportv7 上使用相同的技术解决了这个问题appcompat
模块.我确实尝试了其他一些方法;)
For me it was the only way out of the similar problem with the ActionBarActivity
, which is solved using the same technique on the {SDK}extrasandroidsupportv7appcompat
module. And I did try a few other ways ;)
这篇关于如何将 android.support.v7.widget.GridLayout 添加到 intelliJidea 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!