は、今では、以前のScene
の階層View
から削除するビューを伴うこと、ViewGroupOverlay
でView
を追加、変更方法TransitionUtils.createViewBitmap
ました。どのようにこの結果が副作用を引き起こすか、この方法は除去をバイパスするように設計されているので、View
。
ドキュメントでは、Scene
がレイアウトリソースファイルから作成された場合にのみ、View
を親から削除することができます。
もっと詳しくVisibility.onDisappear
この使用してみてください:
@TargetApi(19)
public class FadeSafeOreo extends Fade {
public FadeSafeOreo() {
super();
}
public FadeSafeOreo(int fadingMode) {
super(fadingMode);
}
@TargetApi(21)
public FadeSafeOreo(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public Animator onDisappear(ViewGroup sceneRoot, TransitionValues startValues, int startVisibility, TransitionValues endValues, int endVisibility) {
RemovedView removedView = null;
boolean existStart = startValues != null && startValues.view != null;
boolean existEnd = endValues != null && endValues.view != null;
if (Build.VERSION.SDK_INT >= 27 && !canRemoveViews() && existStart && !existEnd) {
removedView = new RemovedView(startValues.view);
}
Animator animator = super.onDisappear(sceneRoot, startValues, startVisibility, endValues, endVisibility);
if (removedView != null) removedView.append();
return animator;
}
private static class RemovedView {
private View view;
private ViewGroup parent;
private int position = -1;
private RemovedView(View view) {
this.view = view;
if (view != null && view.getParent() instanceof ViewGroup) {
parent = (ViewGroup) view.getParent();
for (int i = 0, count = parent.getChildCount(); i < count; i++) {
if (parent.getChildAt(i) == view) {
position = i;
return;
}
}
}
}
private void append() {
if (view != null) {
if (parent != null) {
if (view.getParent() != parent && position >= 0) {
parent.addView(view, position);
}
parent = null;
}
view = null;
}
}
}
}
をしかし、これは大規模なビットマップを作成する場合にのOutOfMemoryの問題を解決していません。しかし誰も気にしないようだ) – Yanbaev