AppMsg - Crouton库 - 支持片段?

Tor*_*nas 2 android android-fragments android-alertdialog crouton

我一直在使用AppMsg,这是一个以非侵入方式显示警报的第三方库(最初由Cyril Motier构思).图书馆正常运作,但是有没有人知道如何使用图书馆Fragments

https://github.com/johnkil/Android-AppMsg

可以看出,主要功能makeText需要一个活动context.我如何传递Fragment给这个方法?

public static AppMsg makeText(Activity context, int resId, Style style)
{
    return makeText(context, context.getResources().getText(resId), style);
} 
Run Code Online (Sandbox Code Playgroud)

谢谢,托里.

key*_*fer 9

您可以使用我的Crouton库.

为了在Fragment中显示Crouton,只需调用即可

Crouton.makeText(Activity, String, Style, (ViewGroup) getView()).show();
Run Code Online (Sandbox Code Playgroud)

要么

Crouton.showText(Activity, String, Style, (ViewGroup) getView());
Run Code Online (Sandbox Code Playgroud)