java.lang.IllegalStateException: Cannot start this animator on a detached view!
来源:互联网 发布:如何注销淘宝卖家账号 编辑:程序博客网 时间:2024/06/08 09:01
java.lang.IllegalStateException: Cannot start this animator on a detached view!
在使用fragment添加添加新特新动画的时候,报这个错了,解决方法如下:
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment final View view = inflater.inflate(R.layout.fragment_map_list, container, false); if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { view.addOnLayoutChangeListener(new View.OnLayoutChangeListener() { @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { v.removeOnLayoutChangeListener(this); //进行自己的动画操作 toggleInformationView(view); } }); } return view; }
private void toggleInformationView(View view) { infoContainer = view.findViewById(R.id.contact_card); int cx = (view.getLeft() + view.getRight()) / 2; int cy = (view.getTop() + view.getBottom()) / 2; float radius = Math.max(infoContainer.getWidth(), infoContainer.getHeight()) * 2.0f; if (infoContainer.getVisibility() == View.INVISIBLE) { infoContainer.setVisibility(View.VISIBLE); ViewAnimationUtils.createCircularReveal(infoContainer, cx, cy, 0, radius).start(); } else { Animator reveal = ViewAnimationUtils.createCircularReveal( infoContainer, cx, cy, radius, 0); reveal.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { infoContainer.setVisibility(View.INVISIBLE); } }); reveal.start(); } }
原文来自于:http://stackoverflow.com/questions/26819429/cannot-start-this-animator-on-a-detached-view-reveal-effect
0 0
- java.lang.IllegalStateException: Cannot start this animator on a detached view!
- Android java.lang.IllegalStateException: Cannot start this animator on a detached view!
- SweetSheet的Java.lang.IllegalStateException: Cannot start this animator on a detached view!异常
- java.lang.IllegalArgumentException: You cannot start a load on a fragment before it is attached
- java.lang.IllegalArgumentException: You cannot start a load on a fragment before it is attached
- java.lang.IllegalStateException: Fragment does not have a view
- java.lang.IllegalArgumentException: Removing a detached instance
- java.lang.IllegalArgumentException: Removing a detached instance
- java.lang.IllegalStateException: Cannot perform this operation because the connection pool has been
- 使用RecyclerView中引发 java.lang.IllegalStateException: Cannot call this method while RecyclerView is com
- ParseResult Exception:java.lang.IllegalStateException: Cannot add header view to list -- setAdapter
- java.lang.IllegalStateException: Cannot add header view to list -- setAdapter has already been calle
- java.lang.IllegalStateException:Cannot add header view to list==setAdapter has already been called.
- ParseResult Exception:java.lang.IllegalStateException: Cannot add header view to list -- setAdapter
- java.lang.IllegalStateException:Cannot add header view to list==setAdapter has already been called.
- java.lang.IllegalStateException: Cannot get a numeric value from a text cel
- Exception in thread "main" java.lang.IllegalStateException: Cannot get a text value from a numeric c
- java.lang.IllegalStateException: Can not perform this action after on SaveInstanceState
- swiper的基础使用(八)
- DHTML:<select>
- Thinkphp开源框架如何使用?
- 按行读取ANSI、UNICODE 、UNICODE big endian、UTF-8四种文本文
- IntelliJ IDEA 之 Servlet简单实现
- java.lang.IllegalStateException: Cannot start this animator on a detached view!
- 第十四周项目二(1)-两个成员的类模板
- 数据结构_P19
- Qt国际化多国语言和发布例子
- 关于keystore 证书转*.x509.pem 和*.pk8
- Easyui集成mCustomScrollbar步骤
- swiper的基础使用(九)
- 手机摄像头技术
- Hibernate自学心得