Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个带有列表视图的应用程序。如果你长按列表视图中的一个项目,你会得到一个 DragShadow。现在,如果您有拖放操作的拖动阴影,我想像在对话框中完成的那样使我的应用程序屏幕变暗。
那么是否可以在不使用对话框的情况下在您的应用屏幕上变暗?
您可以在长按 taht 屏幕的父布局上使用 alpha 动画,借助此功能,您可以在没有对话框的情况下使屏幕变暗
Animation animation2 = new AlphaAnimation(1.0f, 0.2f); animation2.setDuration(1000); animation2.setStartOffset(5000); layout.startAnimation(animation2);
或者通过xml文件使用动画
XML 动画