Code Monkey home page Code Monkey logo

banner_master_milaoshu's Introduction

github 地址https://github.com/1104436107/Banner_master_milaoshu

这里写图片描述

1主要有两种模式
convenientBanner.OpenBanner(false); 普通模式 convenientBanner.OpenBanner(true); banner模式

 /**
     * @param model true 打开banner模式  false 普通模式 默认打开
     */
    public void OpenBanner(boolean model) {
        if (model == false) {
            RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams
            (LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
            lp.setMargins(0, 0, 0, 0);
            viewPager.setLayoutParams(lp);
        }
    }

这里写图片描述

2 主MainActivity Activity 中 主要调用代码

 /**
     * @param mcontext  上下文
     * @param imagess   图片数组
     * @param convenientBanner  控件
     * @param title      banner 样式
     * @param mOnItemClickListener  item的点击事件
     */
  new TakeTurns(this, null, convenientBanner,"RotateDown", new OnItemClickListener() {
            @Override
            public void onItemClick(int position){

            }
        });
 @Override
    public void onResume() {
        super.onResume();
        //开始自动翻页
        convenientBanner.startTurning(1000);
    }


    @Override
    public void onPause() {
        super.onPause();
        //停止翻页
        convenientBanner.stopTurning();
    }

3 标红的间距

 <com.milaoshu.convenientbanner.view.CBLoopViewPager
            android:id="@+id/cbLoopViewPager"
            android:layout_width="match_parent"
            android:clipChildren="false"
            android:layout_marginRight="60dp"
            android:layout_marginLeft="60dp"
            android:layout_height="match_parent" />
android:layout_marginRight="60dp"
android:layout_marginLeft="60dp"   设置margin就可以。。。
convenientBanner.getViewPager().setPageMargin(30);  设置图中白色部分的距离

这里写图片描述

4 依赖库依赖就行,,,

这里写图片描述

github 地址https://github.com/1104436107/Banner_master_milaoshu

banner_master_milaoshu's People

Contributors

1104436107 avatar

Watchers

James Cloos avatar  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.