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.
All views of Indicators are fully supported in any layout.
<berlin.volders.indicators.PageIndicators
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:viewPager="@{viewPager}">
<berlin.volders.indicators.PageIndicatorView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:indicator="@drawable/indicator"
app:indicatorSpacing="6dp" />
</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.
app:page
– Get and set the current pageapp:indicatorsObserver
– Register anyPageIndicators.Observer
implementationapp:pageObserver
– Register anyPageIndicators.PageObserver
app:pageCountObserver
– Register anyPageIndicators.PageObserver
app:pageStateObserver
– Register anyPageIndicators.PageStateObserver
app:pageScrollObserver
– Register anyPageIndicators.PageScrollObserver
PageIndicatorView
is an implementation of Indicators to display a simple
Drawable
with a selected state to indicate the current page.
android:fillViewport
– Whether or not to stretch all indicatorsapp:indicator
– The indicator drawableapp:indicatorSpacing
– The spacing between the indicatorsapp:indicatorWidth
– The width of the indicatorapp:indicatorHeight
– The height of the indicator
app:pageIndicators
– Observe changes to the indicators
PageNumberView
is a simple TextView
extension to display the current page
and the page count.
app:indicatorTemplate
– The spacing between the indicators – The template to format the page number and count withapp:indicatorFormatLocalized
– Whether or not to use the default locale for formatting
app:pageIndicators
– Observe changes to the indicators
Add JitPack to your repositories and Indicators to your dependencies
dependencies {
compile "com.github.v2rc:indicators:$indicatorsVersion"
}
Copyright (C) 2016 volders GmbH with <3 in Berlin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.