Гренки не показываются анимация

Я показываю гренки вот так:

    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 просто диапеары. Кто-нибудь еще испытал это или имеет представление, почему это не работает?

1 ответ

Решение

Я тоже столкнулся с проблемой, проверил исходный код демо-версии и обнаружил, что ваш "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();
      }

и, наконец, исправил мою проблему. Надеюсь, это сработает для вас:)

Другие вопросы по тегам