Use Etsy's StaggeredGridView in Eclipse

点点圈 提交于 2020-01-06 08:31:51

问题


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

  1. Download zip file from Github, unzip, and open project folder --> library --> src --> main

  2. Copy all 3 files there: AndroidManifest and the res and src folders

  3. Start new project in Eclipse: File --> New --> Android Application Project

  4. Create project name, select API levels, etc.. click Next

  5. Unclick Create custom icon launcher and Create activity

  6. Click Mark this project as library (if to be used as a library)

  7. Click Finish

  8. Select project title in Package Explorer, then paste those 3 files into there (click "yes to all" to override)

  9. (optional) If importing as a library, right click your main project's name, go to Properties --> Android

  10. At bottom of popup find "Add" button, select your newly imported library, click ok

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!