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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,8 +35,8 @@
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/module_main_card_container_marginTop">
|
||||
android:layout_marginTop="@dimen/module_main_card_container_marginTop"
|
||||
android:layout_height="match_parent">
|
||||
<!-- 卡片-->
|
||||
<FrameLayout
|
||||
android:layout_width="@dimen/module_main_card_container_width"
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- module_main_activity_main.xml-->
|
||||
<dimen name="module_main_map_shadow_frame_width">720px</dimen>
|
||||
<dimen name="module_main_card_container_marginTop">10px</dimen>
|
||||
<dimen name="module_main_card_container_width">660px</dimen>
|
||||
<dimen name="module_main_card_container_marginLeft">60px</dimen>
|
||||
<dimen name="module_main_card_container_marginBottom">211px</dimen>
|
||||
<dimen name="module_main_card_container_paddingBottom">20px</dimen>
|
||||
<dimen name="module_main_map_shadow_frame_width">384px</dimen>
|
||||
<dimen name="module_main_card_container_marginTop">8px</dimen>
|
||||
<dimen name="module_main_card_container_width">352px</dimen>
|
||||
<dimen name="module_main_card_container_marginLeft">32px</dimen>
|
||||
<dimen name="module_main_card_container_marginBottom">140.5px</dimen>
|
||||
<dimen name="module_main_card_container_paddingBottom">18px</dimen>
|
||||
<dimen name="module_main_card_card_shadow_width_div">20px</dimen>
|
||||
<dimen name="module_main_card_card_shadow_height_div">10px</dimen>
|
||||
</resources>
|
||||
@@ -6,5 +6,7 @@
|
||||
<dimen name="module_main_card_container_width">660px</dimen>
|
||||
<dimen name="module_main_card_container_marginLeft">60px</dimen>
|
||||
<dimen name="module_main_card_container_marginBottom">211px</dimen>
|
||||
<dimen name="module_main_card_container_paddingBottom">20px</dimen>
|
||||
<dimen name="module_main_card_container_paddingBottom">30px</dimen>
|
||||
<dimen name="module_main_card_card_shadow_width_div">30px</dimen>
|
||||
<dimen name="module_main_card_card_shadow_height_div">15px</dimen>
|
||||
</resources>
|
||||
@@ -1,10 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- module_main_activity_main.xml-->
|
||||
<dimen name="module_main_map_shadow_frame_width">384px</dimen>
|
||||
<dimen name="module_main_card_container_marginTop">8px</dimen>
|
||||
<dimen name="module_main_card_container_width">352px</dimen>
|
||||
<dimen name="module_main_card_container_marginLeft">32px</dimen>
|
||||
<dimen name="module_main_card_container_marginBottom">140.5px</dimen>
|
||||
<dimen name="module_main_card_container_paddingBottom">20px</dimen>
|
||||
<dimen name="module_main_map_shadow_frame_width">720px</dimen>
|
||||
<dimen name="module_main_card_container_marginTop">10px</dimen>
|
||||
<dimen name="module_main_card_container_width">660px</dimen>
|
||||
<dimen name="module_main_card_container_marginLeft">60px</dimen>
|
||||
<dimen name="module_main_card_container_marginBottom">211px</dimen>
|
||||
<dimen name="module_main_card_container_paddingBottom">30px</dimen>
|
||||
<dimen name="module_main_card_card_shadow_width_div">30px</dimen>
|
||||
<dimen name="module_main_card_card_shadow_height_div">15px</dimen>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user