问题
I wanted to use Etsy's StaggeredGridView in a project of mine on Eclipse. Their gitHub page doesn't provide instructions to import/setup their project in Eclipse. If anyone has successfully done this and can share the steps, it would help a lot!
https://github.com/etsy/AndroidStaggeredGrid
I tried following the steps listed in the link below, but it didn't work. Importing gradle project to eclipse
回答1:
An easy way is to download the ZIP file, extract the entire file to a temp directory, navigate to the \AndroidStaggeredGrid-master\library\src\main\java
directory, and copy the com
folder into your project's src\
directory. Then go to the \AndroidStaggeredGrid-master\library\src\main\res\values
directory and copy the attrs.xml
file to your project's \res\values\
folder (or merge his file with yours if you already have one).
You don't need Gradle to do this. The source just becomes part of your project.
Another way is to do this, is to try and create a JAR file from it, but I haven't tried this yet with an Android project.
回答2:
I have successfully imported the Etsy Staggered GridView into Eclipse. Here are the steps (which work for any Android Studio project you need to get into Eclipse):
Download zip file from Github, unzip, and open project folder --> library --> src --> main
Copy all 3 files there: AndroidManifest and the res and src folders
Start new project in Eclipse: File --> New --> Android Application Project
Create project name, select API levels, etc.. click Next
Unclick Create custom icon launcher and Create activity
Click Mark this project as library (if to be used as a library)
Click Finish
Select project title in Package Explorer, then paste those 3 files into there (click "yes to all" to override)
(optional) If importing as a library, right click your main project's name, go to Properties --> Android
At bottom of popup find "Add" button, select your newly imported library, click ok
Done!
回答3:
@ Qian
U must copy the attrs.xml or its content to your projects attrs.xml. make sure to copy the whole thing like this;
<declare-styleable name="StaggeredGridView">
<attr name="column_count" format="integer" />
<attr name="column_count_portrait" format="integer" />
<attr name="column_count_landscape" format="integer" />
<attr name="item_margin" format="dimension" />
<attr name="grid_paddingLeft" format="dimension" />
<attr name="grid_paddingRight" format="dimension" />
<attr name="grid_paddingTop" format="dimension" />
<attr name="grid_paddingBottom" format="dimension" />
</declare-styleable>
to your own attires.xml
then in the error file import your own com.example.example in the R.
来源:https://stackoverflow.com/questions/22701363/use-etsys-staggeredgridview-in-eclipse