GithubHelp home page GithubHelp logo

simpletablayout's Introduction

1.SimpleTablayout

SimpleTablayout 只支持竖向展示的tabLayout样式,且item的样式目前也是固定的。后续如果需要会添加其他样式。

2.使用

 		//simpleTablelayout 组件只适用与竖向的tabLayout结构
        mTablayout = (SimpleTabLayout) findViewById(R.id.tablayout);
        //item之间的上下间距
        mTablayout.setItemMargin(50);

        //item的高度
        mTablayout.setItemHeight(100);

        mTablayout.setTabAdapter(new TabAdapter() {
            @Override
            public int getCount() {
                return 13;
            }

            @Override
            public TabView.TabIcon getIcon(int position) {
                //配置item里的图片
                return new ITabView.TabIcon.Builder()
                        //图片的状态切换
                        .setIcon(R.drawable.un_ic_baseline_5g_24, R.drawable.ic_baseline_5g_24)
                        //图片的位置
                        .setIconGravity(Gravity.START)
                        //图片和文字的间距
                        .setIconMargin(20)
                        //图片的大小
                        .setIconSize(40, 40)

                        .build();
            }

            @Override
            public TabView.TabTitle getTitle(int position) {
                //文字内容  文字的状态切换后的颜色,文字大小
                return new TabView.TabTitle.Builder()
                        .setContent("GGG-" + position)
                        .setTextColor(R.color.black, android.R.color.holo_red_light)

                        .setTextSize(22)
                        .build();
            }


        });

        mTablayout.addOnTabSelectedListener(new SimpleTabLayout.OnTabSelectedListener() {
            @Override
            public void onTabSelected(TabView tab, int position) {
                Log.d(TAG, "onTabSelected: " + position);
            }

            @Override
            public void onTabReselected(TabView tab, int position) {

                Log.d(TAG, "onTabReselected: " + position);
            }
        });

simpletablayout's People

Contributors

viewuse avatar cts33 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.