dev
This commit is contained in:
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.module.main.R;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
|
||||
public class VerticalStackTransformer extends VerticalBaseTransformer {
|
||||
@@ -14,6 +15,8 @@ public class VerticalStackTransformer extends VerticalBaseTransformer {
|
||||
|
||||
public VerticalStackTransformer( Context context ) {
|
||||
this.context = context;
|
||||
spaceBetweenFirAndSecHeight = context.getResources().getDimensionPixelSize( R.dimen.module_main_card_card_shadow_height_div );
|
||||
spaceBetweenFirAndSecWith = context.getResources().getDimensionPixelSize( R.dimen.module_main_card_card_shadow_width_div );
|
||||
}
|
||||
|
||||
public VerticalStackTransformer( Context context, int spaceBetweenFirAndSecWith, int spaceBetweenFirAndSecHeight ) {
|
||||
@@ -30,7 +33,7 @@ public class VerticalStackTransformer extends VerticalBaseTransformer {
|
||||
//控制停止滑动切换的时候,只有最上面的一张卡片可以点击
|
||||
page.setClickable( true );
|
||||
} else {
|
||||
float scale = ( float ) ( page.getWidth() - WindowUtils.dip2px( context, spaceBetweenFirAndSecWith * position ) ) / ( float ) ( page.getWidth() );
|
||||
float scale = ( float ) ( page.getWidth() - spaceBetweenFirAndSecWith * position ) / ( float ) ( page.getWidth() );
|
||||
//控制下面卡片的可见度
|
||||
page.setAlpha( 1.0f );
|
||||
//控制停止滑动切换的时候,只有最上面的一张卡片可以点击
|
||||
@@ -39,7 +42,7 @@ public class VerticalStackTransformer extends VerticalBaseTransformer {
|
||||
page.setPivotY( page.getHeight() / 2f );
|
||||
page.setScaleX( scale );
|
||||
page.setScaleY( scale );
|
||||
page.setTranslationY( -page.getHeight() * position + ( page.getHeight() * 0.5f ) * ( 1 - scale ) + WindowUtils.dip2px( context, spaceBetweenFirAndSecHeight ) * position );
|
||||
page.setTranslationY( -page.getHeight() * position + ( page.getHeight() * 0.5f ) * ( 1 - scale ) + spaceBetweenFirAndSecHeight * position );
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user