toast

Growl/toast style notifications library for iOS

夙愿已清 提交于 2019-11-30 03:17:53
Can anyone recommend a library for implementing growl or toast-style notifications on iOS? For example, after a user saves a profile, I want to have a notification fade in, linger for 3 seconds, report "profile saved", and fade out. Right now I have a UIAlertView that interrupts the user's workflow with a single "OK" button, and I feel like that is overkill. The Android Toast class is an example of what I am looking for on iOS. Thanks! I created a solution that I think you'll find useful: https://github.com/scalessec/toast It's written as a obj-c category, essentially adding makeToast methods

Toast equivalent for Xamarin Forms

独自空忆成欢 提交于 2019-11-29 19:50:09
Is there any way using Xamarin Forms (not Android or iOS specific) to have a pop-up, like Android does with Toast, that needs no user interaction and goes away after a (short) period of time? From searching around all I'm seeing are alerts that need user clicks to go away. Alex Chengalan There is a simple solution for this. By using the DependencyService you can easily get the Toast-Like approach in both Android and iOS. Create an interface in your common package. public interface IMessage { void LongAlert(string message); void ShortAlert(string message); } Android section [assembly: Xamarin

Menu菜单

半城伤御伤魂 提交于 2019-11-29 19:27:19
Menu菜单: 在menu目录下新建main_menu.xml: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/menu1" android:title="菜单1" android:icon="@mipmap/ic_launcher"/> <item android:id="@+id/menu2" android:title="菜单2" android:icon="@mipmap/ic_launcher"/> <item android:id="@+id/menu3" android:title="菜单3" android:icon="@mipmap/ic_launcher"/> <item android:id="@+id/menu4" android:title="菜单4" android:icon="@mipmap/ic_launcher"/> </menu> 举例新建了四个菜单 MainActivity: package com.fitsoft; import android.os.Bundle; import android.support.v7.app

【学习笔记】Window和WindowManager知识点

允我心安 提交于 2019-11-29 18:39:44
正文: (网络盗图,侵删) (网络盗图,侵删) 1. Window是一个抽象类,其实现是PhoneWindow。WindowManager是外界访问Window的入口。Window的具体实现位于WindowManagerService中,WindowManager和WindowManagerService的交互是一个IPC过程。Android中所有视图都是通过Window来呈现的,Activity、Dialog和Toast实际上都附加在Window上。因此Window实际是View的直接管理者。 2. Window有三种类型,分别是应用Window、子Window和系统Window。应用类Window对应着一个Activity。子Window不能单独存在,需要附属在特定的父Window之中,比如常见的一些Dialog。系统Window是需要声明权限才能创建的Window,比如Toast和系统状态栏。 3. Window是分层的,层级大的会覆盖在层级小的Window上面。层级范围顺序:系统Window>子Window>应用Window。层级范围对应WindowManager.LayoutParams的type参数。如果需要最大层级,可使用系统层级的type,但同时需要声明权限。 4. WindowManager继承自ViewManager。提供了三个常用方法:addView

第八章 理解Window和WindowManager

余生长醉 提交于 2019-11-29 18:34:49
Window是一个抽象类,它的具体是现实 PhoneWindow ,通过 WindowManager 就可以创建Window。WindowManager是外界访问Window的入口,但是Window的具体实现是在 WindowManagerService 中,WindowManager和WindowManagerService的交互是一个IPC的过程。所有的视图例如Activity、Dialog、Toast都是附加在Window上的。 8.1 Window和WindowManager (1). 通过WindowManager添加View 的过程:将一个Button添加到屏幕坐标为(100,300)的位置上。 mFloatingButton = new Button( this ); mFloatingButton.setText( "test button" ); mLayoutParams = new WindowManager.LayoutParams(LaytouParams.WRAP_CONTENT,LaytoutParams.WRAP_CONTENT, 0 , 0 ,PixelFormat.TRANSPARENT); //0,0,分别是type和flags参数,在后面分别配置了。 mLaytouParams.flags = LayoutParams.FLAG_NOT

Window和WindowManager(Android开发艺术探索学习笔记)

自闭症网瘾萝莉.ら 提交于 2019-11-29 18:34:29
概述 Window表示一个窗口的概念,它是一个抽象类,它的具体实现类是PhoneWindow 。 WindowManager是外界访问Window的入口,Window的具体实现位于WindowManagerService中 。 WindowManager和WindowManagerService的交互其实是一个IPC过程。Android中所有视图都是通过Window来呈现的,无论是Activity,Dialog还是Toast,它们的视图都是附加在Window上的,因此Window是View的直接管理者。从事件分发的流程可以知道,触摸事件是由Window传递给DecorView的,Activity的setContentView()在底层也是通过Window来完成的。 WindowManager.LayoutParams 为了分析Window的工作机制,我们先了解WindowManager.LayoutParams,如下: mWindowManager = (WindowManager) getSystemService(Context .WINDOW _SERVICE) ; mFloatingButton = new Button(this) ; mFloatingButton .setText ( "click me" ) ; mLayoutParams = new

android开发window和windowmanager

家住魔仙堡 提交于 2019-11-29 18:34:16
Window是一个抽象类,具体实现是PhoneWindow。创建一个Window只需要通过WindowManager即可WindowManager是外界访问Window的入口,Window的具体实现位于WindowManagerService中,WindowManager和WindowManagerService的交互是一个IPC过程。Android中的所有试图都是通过Window呈现的。无论是Activity、Dialog、Toast,他们的视图实际上都是附加在Window上的,因此Window实际是View直接管理者。 Flags参数表示Window的属性,通过这些选项可以控制Window的显示特性。 Window有三种类型,分别是应用Window、子Window和系统Window,应用类Window对应着一个Activity。子Window不能单独存在,它需要附属在特定的父Window之上,比如常见的一些Dialog就是一个字Window。系统Window是需要特定声明权限才能够创建的Window,比如Toast和系统状态栏这些都是系统Window。 Window会有层的概念,层级大的会覆盖在层级小得Window上面。在三类Window中,应用层Window的层级范围是1-99,字Window的层级范围是1000-1999,系统Window的层级范围是2000-2999

Android源码分析之理解Window和WindowManager

孤街浪徒 提交于 2019-11-29 18:32:00
Window和WindowManager概述 Window是一个抽象类,它的具体实现是PhoneWindow,创建一个Window通过WindowManager 就可以完成。WindowManager是外界访问Window的入口,它的具体实现在WindowManagerService中,WindowManager和WindowManagerService的交互是一个IPC的过程。Android中所有的视图都是通过Window来呈现的,无论是Activity,Dialog还是Toast,Window实际上是View的直接管理者。单击时间由Window传递给DecorView,然后DecorView再传递给我们的View,就连Activity设置视图的方法setContentView底层也是通过Window来完成的。 WindowManager继承于ViewManager: public interface WindowManager extends ViewManager ViewManager中有3个抽象的方法: public interface ViewManager { /** * Assign the passed LayoutParams to the passed View and add the view to the window. * <p>Throws {

Android: Adding a delay to the display of toast?

≯℡__Kan透↙ 提交于 2019-11-29 17:44:48
I wish to display a toast if a certain condition is true or false . However I want this toast to delay for two seconds before it is displayed. How can I do this? Current if statement: if (result.equals("true")) { loginDataBaseAdapter.updateUploadedRecord(sessionId); Toast.makeText(MathsGameResults.this, "Data is successfully uploaded.", Toast.LENGTH_LONG).show(); } else { Toast.makeText( MathsGameResults.this, "Error while uploading. Please try again later.", Toast.LENGTH_LONG).show(); } } Try this.. Use Handler // Handler which will run after 2 seconds. new Handler().postDelayed(new Runnable(

How do I make a toast from a non activity class?

为君一笑 提交于 2019-11-29 13:51:24
I have a class that I am using to get GPS data within my activity. In the constructor I pass it the activity's context: gpsFetcher = new GPSFetcher(this); and in the gpsFetcher class I have: this.context = c.getApplicationContext(); OR just this.context = c; and then I call the toast with: Toast.makeText(context, "sometext", Toast.LENGTH_LONG); But it never shows up... Is there something I'm missing? Is it possible? Thanks! Are you forgetting Toast#show ? Toast toast = Toast.makeText(context, "sometext", Toast.LENGTH_LONG); toast.show(); Hasid Mansoori You must call show() as well: Toast