项目作者: vertragswecker

项目描述 :
Indicators for a ViewPager
高级语言: Java
项目地址: git://github.com/vertragswecker/Indicators.git
创建时间: 2017-01-30T20:56:11Z
项目社区:https://github.com/vertragswecker/Indicators

开源协议:Apache License 2.0

下载


Indicators" class="reference-link">Icon Indicators

Build
Release

Indicators is a micro framework for creating ViewPager indicators. Instead
of limited indicator implementations, it provides the means to create new
indicator types without a big effort.

This library works well together with the Android Data Binding Library and Binding Supplies.

Example

Usage

All views of Indicators are fully supported in any layout.

  1. <berlin.volders.indicators.PageIndicators
  2. android:layout_width="wrap_content"
  3. android:layout_height="wrap_content"
  4. app:viewPager="@{viewPager}">
  5. <berlin.volders.indicators.PageIndicatorView
  6. android:layout_width="wrap_content"
  7. android:layout_height="wrap_content"
  8. app:indicator="@drawable/indicator"
  9. app:indicatorSpacing="6dp" ></berlin.volders.indicators.PageIndicatorView>
  10. </berlin.volders.indicators.PageIndicators>

\

PageIndicators is the parent layout to bind to any ViewPager. It defines a
@ViewPager.DecorView to be added to a ViewPager parent directly in XML and
integrates well with the Android Data Binding Library providing everything
needed to create indicators easily.

Bindings
  • app:page
    – Get and set the current page
  • app:indicatorsObserver
    – Register any PageIndicators.Observer implementation
  • app:pageObserver
    – Register any PageIndicators.PageObserver
  • app:pageCountObserver
    – Register any PageIndicators.PageObserver
  • app:pageStateObserver
    – Register any PageIndicators.PageStateObserver
  • app:pageScrollObserver
    – Register any PageIndicators.PageScrollObserver

\

PageIndicatorView is an implementation of Indicators to display a simple
Drawable with a selected state to indicate the current page.

Attributes
  • android:fillViewport
    – Whether or not to stretch all indicators
  • app:indicator
    – The indicator drawable
  • app:indicatorSpacing
    – The spacing between the indicators
  • app:indicatorWidth
    – The width of the indicator
  • app:indicatorHeight
    – The height of the indicator
Bindings
  • app:pageIndicators
    – Observe changes to the indicators

\

PageNumberView is a simple TextView extension to display the current page
and the page count.

Attributes
  • app:indicatorTemplate – The spacing between the indicators
    – The template to format the page number and count with
  • app:indicatorFormatLocalized
    – Whether or not to use the default locale for formatting
Bindings
  • app:pageIndicators
    – Observe changes to the indicators

Installation

Add JitPack to your repositories and Indicators to your dependencies

  1. dependencies {
  2. compile "berlin.volders:indicators:$indicatorsVersion"
  3. }

License

  1. Copyright (C) 2016 volders GmbH with <3 in Berlin
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.