GithubHelp home page GithubHelp logo

fastlayout's Introduction

FastLayout

A library for putting views in rows and columns

Download License: MIT

With this library you can put your desired views in tabular form with just a few lines of code.

Usage

Step 1

In you layout.xml put the fastlayout View with attributes:

    <com.alihamuh.fastTableLayout.FastLayout
        android:id="@+id/rows"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:square_size="9"
        app:cell_view="@layout/cell_view">

    </com.alihamuh.fastTableLayout.FastLayout>

You can use square_size for equal no of rows and columns or you can use no_of_columns and no_of_rows for un equal no of rows and columns.

You can define cell_view which can be your custom view for every cell here or in java.

Step 2

     FastLayout view= findViewById(R.id.rows);


        ArrayList<FastAttributes> attributes=new ArrayList<>();
        for(int index=0;index<81;index++){
            FastAttributes attr=new FastAttributes();

            attr.setButtonText(Integer.toString(index));   //text attribute of your view

            View.OnClickListener onClickListener= new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                   ////your code////////
                }
            };

            attr.setOnClickListener(onClickListener);

            attributes.add(attr);
        }

        view.setFastAttributesList(attributes);     

You can access fastLayout in java and set its rows and columns.

If you want to change attribues of all the cells like color, text, onClick etc you can do so in a for loop equal to your square size i.e rowxcol. The attributes are entered in the list in a linear manner i.e row by row like this:

Setup:

Gradle:

Enter this in your build.gradle file:

implementation 'com.alihamuh.fastTableLayout:fastTableLayout:<latest-version>'

and use the library.

Note: <latest-version> value can be found on the JitPack badge above the preview images.

Documentation

Class FastLayout

Method Description
setFastAttributesList(java.util.ArrayList fastAttributesList) sets an ArrayList of attributes for all your cell views setNoOfColumns(java.lang.Integer noOfColumns)
setNoOfRows(java.lang.Integer noOfRows) Sets no of rows for your cells
setSquareSize(java.lang.Integer squareSize) Sets a square view with equal no of rows and columns

Class FastAttributes

Method Description
setBackgroudResource(int backgroudResource) For background Resource
setBackgroundColor(int backgroundColor) For Color
setBackgroundDrawable(android.graphics.drawable.Drawable backgroundDrawable) Drawable
setButtonText(java.lang.String buttonText) For a button
setCustomView(android.view.View customView) If you want a custom view for a specific cell
setOnClickListener(android.view.View.OnClickListener onClickListener) For handling button and view Clicks
setTextColor(int textColor) For text Color
setTextViewText(java.lang.String textViewText) For setting Text

Contributing

Found a bug? feel free to fix it and send a pull request or open an issue.

fastlayout's People

Contributors

alihamuh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.