How to use Staggeredgridview in eclipse

Source: Internet
Author: User

Overview

now the development tools are basically used androidstudio. The open source framework is also available online. For example, do waterfall UI Staggeredgridview, as well as navigation page Pagerslidingtabstrip and so on.

So the computer performance is not good, still using eclipse how to use these open source framework?

Steps

Preparatory work

Download the corresponding frame as Staggeredgridview in Https://github.com/maurycyw/StaggeredGridView.

Unzip the end. The required resources are the following: three Java files under Staggeredgridview-master\src\com\origamilabs\library\views;

Staggeredgridview-master\res\values's Attrs.xml

Steps:

1. Open the Androidmanifest.xml under Staggeredgridview and copy the android:allowbackup= "true" to the corresponding location in your project.

2. If your project res/values without attrs.xml, then paste this in Staggeredgridview directly in your folder. If you already exist there

This file, then copy the code into your attrs.xml. Be aware of the custom property name here, and so on the reference is used here (it is possible and online information Staggeredgridview attribute name is not the same, do not directly copy the code, the wrong do not know)

<declare-styleablename= "Staggeredgridview">        <attrname= "Drawselectorontop"format= "Boolean" />        <attrname= "NumColumns"format= "integer" />        <attrname= "Itemmargin"format= "Dimension" />    </declare-styleable>

3. Copy the Java file to your project (note that the three files are copied to the package with the same package name as your androidmanifest.xml, so you will not be prompted to find the resource when you define the view configuration XML)

The next three files, such as Scrollercompat.java, will prompt an error. Just change the package name to your project. Staggeredgridview.java also has an import COM.ORIGAMILABS.LIBRARY.R; error, just remove this right.

4. Finally, you can use it in the layout file. You should also bring the package name when you add it. You can directly right-click on the blue selected file and then tap copy qualified name. The full name is copied.

Like mine is.

< com. Mihai.text.StaggeredGridView            android:id= "@+id/stagger_view"            Android:layout_ Width= "Match_parent"            android:layout_height= "Match_parent"            App : itemmargin= "8DP"            app:numcolumns= "2"            >                    </ com. Mihai.text.StaggeredGridView>

Postscript

To start with Android, don't be fooled by the word frame, just copy all of its relevant code to our project, including configuration files, custom attributes, etc. Of course there will be errors, common is the package name and XXX. R file is wrong, just import your own on it. There is a Android.support.v4.jar package error, prompt import XXX error. It may be the wrong version because the V4 support package is also available in different versions with the latest.

How to use Staggeredgridview in eclipse

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.