我显示一个 Crouton像这样:
Builder b = new Builder();
b.setBackgroundColor(R.color.mygreen);
b.setTextAppearance(R.style.LargeTextWhite);
Configuration.Builder configBuilder = new Configuration.Builder();
configBuilder.setInAnimation(R.anim.slide_up).setOutAnimation(
R.anim.shake);
b.setConfiguration(configBuilder.build());
Crouton.makeText(getActivity(),
"" + e.getResult().getTotalCount() + " Treffer", b.build(),
root).show();
其中root
是一个ViewGroup
;
显示了 inAnimation
,outAnimation
没有显示,Crouton
只是消失了。
其他人也经历过这种情况或者知道为什么它不起作用吗?
最佳答案
我也遇到了这个问题,我检查了演示的源代码,发现你的“root”应该是:
<LinearLayout
android:id="@+id/croutonContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" />
private void showCustomViewCrouton() {
View view = getLayoutInflater(null).inflate(R.layout.layout_crouton_custom_view, null);
final Crouton crouton;
final Configuration croutonConfig = new Configuration.Builder().setDuration(Configuration.DURATION_SHORT).setInAnimation(android.R.anim.fade_in).setOutAnimation(android.R.anim.fade_out).build();
crouton = Crouton.make(getActivity(), view, R.id.croutonContainer, croutonConfig);
crouton.show();
}
终于解决了我的问题。希望它对你有用:)
关于android - 油煎面包 block 没有显示出来动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22196989/