Skip to content

Commit eb97d54

Browse files
committed
fix layout
1 parent 651a40a commit eb97d54

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

cardstackview/src/main/java/me/brucezz/cardstackview/CardStackView.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ public class CardStackView extends ViewGroup {
4040

4141
private CardHolder mSelected;
4242

43+
private boolean mSkipLayout = false;
44+
45+
public void setSkipLayout(boolean skipLayout) {
46+
mSkipLayout = skipLayout;
47+
}
48+
4349
public CardStackView(Context context) {
4450
this(context, null);
4551
}
@@ -266,6 +272,7 @@ private boolean existsValidChild() {
266272

267273
@Override
268274
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
275+
if (mSkipLayout) return;
269276
updateCardPosition();
270277
}
271278

@@ -277,9 +284,9 @@ public void updateCardPosition() {
277284

278285
for (int i = 0; i < mCardFactory.size(); i++) {
279286
CardHolder holder = mCardFactory.get(i);
280-
//if (!holder.isAnimating()) {
287+
if (!holder.isAnimating()) {
281288
holder.layoutFixed();
282-
//}
289+
}
283290
}
284291
}
285292

0 commit comments

Comments
 (0)