对于不使用appcompat-v7的活动,Snackbar类似于(在应用程序通知中) [英] Snackbar lookalike (in app notifications) for activities not using appcompat-v7

查看:25
本文介绍了对于不使用appcompat-v7的活动,Snackbar类似于(在应用程序通知中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在应用程序通知中显示(不是对话框,而是在应用程序通知中显示重量轻),
它还应该具有与环聊功能类似的按钮:

I want to show in app notifications (not a dialog, but a light weight in app notification),
It should also have button similar to what hangouts does:

鉴于我的应用程序中的活动请勿使用 appcompat-v7,我无法使用快餐栏:

I cannot use snackbar given that activities in my app do not use appcompat-v7: Snackbar on Android without changing theme, Is there a way to implement the above feature without using external libraries like TSnackbar, etc.
Is fragment a good idea?

谢谢.

推荐答案

您可以使用吐司.

    Context context = getApplicationContext();
    CharSequence text = "Hello toast!";
    int duration = Toast.LENGTH_SHORT;

    Toast toast = Toast.makeText(context, text, duration);
    toast.show();

这篇关于对于不使用appcompat-v7的活动,Snackbar类似于(在应用程序通知中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆