Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
650 views
in Technique[技术] by (71.8m points)

intellij idea - How to add android.support.v7.widget.GridLayout into intelliJidea?

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.

can anyone explain obviously?

Edit: I have the same problem at this thread

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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).

The easiest way is as follows.

  1. Make sure you have installed the Android Support Library, from the Android SDK Manager. enter image description here

  2. In IDEA: Open your project, then select File / Import Module

    • select the directory under the SDK: {SDK}extrasandroidsupportv7gridlayout enter image description here
    • select Import module from external model and Eclipse
    • 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 and android-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.
  3. Now you have to update your project dependencies to this module for the resources, and add the .jar libraries. Select File / Project Structure

    • 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) a Module dependency... to the android-support-v7-gridlayout enter image description here
    • 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: enter image description here

And now you should be fine.

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 ;)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...