Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.google.androidstudio.motionlayoutexample.utils
- import android.content.Context
- import android.support.constraint.motion.MotionLayout
- import android.support.v4.view.ViewPager
- import android.util.AttributeSet
- class ViewpagerHeader @JvmOverloads constructor(
- context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
- ) : MotionLayout(context, attrs, defStyleAttr), ViewPager.OnPageChangeListener {
- override fun onPageScrollStateChanged(state: Int) {
- }
- override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
- progress = position / 2.0f + positionOffset * (1 / 2f)
- }
- override fun onPageSelected(position: Int) {
- }
- }
Add Comment
Please, Sign In to add comment