|
1 | 1 | # StackViewLayout |
2 | | -**A swipe ViewGroup that supports left and right slide.** |
| 2 | + 1.支持布局预览、宽高比设置、viewType布局 |
| 3 | + 2.支持自动播放、左右布局 |
| 4 | + 3.支持缩放滑动、连续滑动 |
3 | 5 |
|
4 | | -**层叠View支持手势左右滑动,自动轮播,过渡动画** |
5 | | - |
6 | | -1.onMeasure通过StackAdapter适配器取到itemView加入到StackLayaout容器 |
7 | | - |
8 | | - onMeasure() through stackAdapter add view to StackLayout |
9 | | - |
10 | | -2.onLayout取到childView按照层叠布局 |
11 | | - |
12 | | - onLayout() get child view layout stack ui |
13 | | - |
14 | | -3.onInterceptTouchEvent处理手势支持子View及Velocity |
15 | | - |
16 | | - onInterceptTouchEvent() support child view gesture |
17 | | - |
18 | | -4.onTouchEvent处理手势,释放后播放动画平滑过渡 |
19 | | - |
20 | | - onTouchEvent() swipe animation,when release recover animation |
21 | | - |
22 | | -### Captures |
23 | | - |
24 | | - |
25 | | - |
26 | | - |
27 | | - |
28 | | - |
29 | | -<li>注释:此图解释参数意义,展示效果不太精确,图片真实宽度为**上层橙色** |
| 6 | +#### Captures |
| 7 | +   |
30 | 8 |
|
31 | 9 | ### Use |
32 | | - implementation 'com.uis:stacklayout:0.3.4' |
| 10 | + implementation 'com.uis:stackviewlayout:0.1.0' |
| 11 | + |
| 12 | +### [老版本](README-StackLayout.md) |
33 | 13 |
|
34 | 14 | *Name*| *Descript*|*Value* |
35 | 15 | -----|--------|--- |
36 | | -stackSpace|间距(space)|默认值(default):10dp |
| 16 | +stackEdgeModel|层叠位置(stack model)|left/right |
37 | 17 | stackEdge|边界距离(edge)|默认值(default):10dp |
38 | | -stackZoomX|x方向缩放(x zoom)| 0<x<=1,1表示等间距,默认值(default):1 |
39 | | -stackPadX|x方向偏移(x padding)|表示偏移间距,默认值:0 |
40 | | -stackPadX|PadX*(Size-1) < Space|PadX优先级高于ZoomX |
41 | | -stackZoomY|y方向缩放(y zoom)| 0<y<=1,1表示和顶层等高度,默认值:0.9 |
42 | | -stackLooper|自动轮播(looper)|false/true |
| 18 | +stackPaddingX|x方向偏移距离|10dp |
| 19 | +stackOffsetX|x方向偏移因子|2dp |
| 20 | +stackPaddingY|y方向偏移距离|10dp |
| 21 | +stackOffsetY|y方向偏移因子|2dp |
| 22 | +stackAutoPlay|自动轮播(looper)|true |
43 | 23 | stackSize|层叠数量(stack size)|3 |
44 | | -stackEdgeModel|层叠位置(stack model)|left/right |
45 | | - |
46 | | -``` |
47 | | - <?xml version="1.0" encoding="utf-8"?> |
48 | | - <com.uis.stackview.StackLayout xmlns:android="http://schemas.android.com/apk/res/android" |
49 | | - xmlns:stack="http://schemas.android.com/apk/res-auto" |
50 | | - android:id="@+id/stacklayout" |
51 | | - android:layout_width="match_parent" |
52 | | - android:layout_height="wrap_content" |
53 | | - stack:stackSpace="5dp" |
54 | | - stack:stackEdge="20dp" |
55 | | - stack:stackZoomX="0.1" |
56 | | - stack:stackZoomY="0.1" |
57 | | - stack:stackLooper = "false" |
58 | | - stack:stackSize = "5" |
59 | | - stack:stackEdgeModel = "left"> |
60 | | - </com.uis.stackview.StackLayout> |
61 | | -``` |
62 | | - |
63 | | -``` |
64 | | - stackViewLayout.setStackLooper(true); |
65 | | - stackViewLayout.setAdapter(new StackLayout.StackAdapter() { |
66 | | - @Override |
67 | | - public View onCreateView(ViewGroup parent) { |
68 | | - return LayoutInflater.from(parent.getContext()).inflate(R.layout.item_fresco_layout,null); |
69 | | - } |
70 | | -
|
71 | | - @Override |
72 | | - public void onBindView(View view, int position) { |
73 | | - SimpleDraweeView dv = view.findViewById(R.id.imageView); |
74 | | - DraweeController controller = Fresco.newDraweeControllerBuilder() |
75 | | - .setUri(Uri.parse(dataList.get(position).getMapImageUrl())) |
76 | | - .setTapToRetryEnabled(true) |
77 | | - .setOldController(dv.getController()) |
78 | | - .build(); |
79 | | - dv.setController(controller); |
80 | | - } |
81 | | -
|
82 | | - @Override |
83 | | - public int getItemCount() { |
84 | | - return dataList.size(); |
85 | | - } |
86 | | -
|
87 | | - @Override |
88 | | - public void onItemDisplay(int position) { |
89 | | - Log.e("xx","display = " + position); |
90 | | - } |
91 | | -
|
92 | | - @Override |
93 | | - public void onItemClicked(int position) { |
94 | | - Log.e("xx","clicked = " + position); |
95 | | - stackViewLayout.setStackLooper(false); |
96 | | - stackViewLayout.setPosition(position+3); |
97 | | - } |
98 | | - }); |
99 | | - stackViewLayout.setPosition(10);//指定位置 |
100 | | -``` |
101 | | - |
102 | | -### Version |
103 | | -*Version*| *Descript*|*Fixed* |
104 | | -----|----|---- |
105 | | -0.0.1|自动轮播,滑动从顶部移除,整体上浮|support auto looper and animation |
106 | | -0.0.2|滑动从顶层加入,整体下沉|fixed child view clicked event |
107 | | -0.1.0|zoomX,zoomY呈等比数列|modify attribute |
108 | | -0.1.1|只有一条数据时|fixed adapter itemSize=1 |
109 | | -0.1.2|增加动画、轮播时间设置,获取当前选中位置|add animation,looper time |
110 | | -0.2.0|只有一个元素,不支持轮播和滑动|only one child,can't swipe |
111 | | -0.2.1|减少child层级,见child.measure()|child.measure() opt |
112 | | -0.3.0|增加联动效果(缩放+平移)|support whole animation |
113 | | -0.3.1|联动动画平滑过度|fixed animation smooth |
114 | | -0.3.2|联动动画去抖动及adapter数据更新会多出层|opt animation shake |
115 | | -0.3.3|adapter数据更新ui展示错误|opt adapter changed display |
116 | | -0.3.4|滑动促发item点击事件|fixed item clicked event |
| 24 | +stackAspectRatio|宽高比,宽度须有值|0 |
117 | 25 |
|
118 | 26 | ### License |
119 | 27 |
|
|
0 commit comments