Giter Club home page Giter Club logo

android-universal-viewpager-indicator's Introduction

Android-Universal-ViewPager-Indicator

Android 通用的ViewPager的指示器

效果图

效果图

自定义属性

属性 说明
normal_color 未选中的指示器颜色
selected_color 选中的指示器颜色
spacing 指示器每个item之间的间距
orientation 设置指示器排列方向,枚举类型,有horizontalvertical
style 枚举类型,有如下几种类型

样式说明

style 说明
circle_circle 圆点指示器,对应图中第一种样式
rect_rect 长条指示器,对应图中第二种样式
circle_rect 指示器选中是长条,未选中是圆点,对应图中第三种样式

如果style设置为 circle_circle可设置以下属性:

属性 说明
circle_circle_radius 都是圆点指示器半径大小

如果style设置为 rect_rect可设置以下属性:

属性 说明
rect_rect_itemWidth 条形长度
rect_rect_itemHeight 条形高度
rect_rect_corner 条形圆角

如果style设置为 circle_rect可设置以下属性:

属性 说明
circle_rect_radius 未选中圆点半径
circle_rect_itemWidth 选中条形长度
circle_rect_itemHeight 选中条形高度
circle_rect_corner 选中条形设置圆角

使用方法

<FrameLayout
        android:layout_width="match_parent"
        android:layout_marginTop="10dp"
        android:layout_height="120dp">

    <android.support.v4.view.ViewPager
        android:id="@+id/viewPager3"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/darker_gray" />

    <com.wzh.viewpager.indicator.UIndicator
        android:id="@+id/indicator3"
        android:layout_width="match_parent"
        android:layout_height="6dp"
        android:layout_gravity="bottom|center_horizontal"
        android:layout_marginBottom="10dp"
        app:circle_rect_corner="3dp"
        app:circle_rect_itemHeight="4dp"
        app:circle_rect_itemWidth="20dp"
        app:circle_rect_radius="3dp"
        app:normal_color="#99ffffff"
        app:selected_color="#ffffff"
        app:spacing="10dp"
        app:orientation="horizontal"
        app:style="circle_rect" />
</FrameLayout>

在代码里需要关联上我们的ViewPager:

//普通ViewPager使用
...
ViewPager mViewPager1 = findViewById(R.id.viewPager1);
UIndicator uIndicator1 = findViewById(R.id.indicator1);
uIndicator1.attachToViewPager(mViewPager1);

// UltraViewPager使用
...
UltraViewPager mViewPager4 = findViewById(R.id.viewPager4);
UIndicator uIndicator4 = findViewById(R.id.indicator4);
uIndicator4.attachToViewPager(mViewPager4.getViewPager());

android-universal-viewpager-indicator's People

Contributors

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