toast

vue函数组件

落花浮王杯 提交于 2019-12-07 16:20:10
vue函数组件 有时候我们需要在非vue文件使用组件,这时候我们可以通过vue插件的方式使用 一、js加载文件 import Vue from 'vue'; import toast from'./index.vue'; const ToastConstructor = Vue.extend(toast); let toastPool = []; let instance; let installed = false; //安装组件 const install = function (Vue, config = {}) { if (installed) return; console.log(installed); Vue.component(toast.name, toast); installed = true; }; install(Vue); let getAnInstance = () => { if (toastPool.length > 0) { let instance = toastPool[0]; toastPool.splice(0, 1); return instance; } return new ToastConstructor({ el: document.createElement('div') }); }; let Toast = (options

XmlHttpRequest on Tizen TV exits application

萝らか妹 提交于 2019-12-07 16:19:26
问题 I am currently developping an app for Samsung Tizen and WebOS TVs. For this, I am using Samsung's TOAST and Caph with angular1. The generated .wgt is working fine on browser and TV Simulator, but on real device, the application exits when an XMLHttpRequest is sent. Here is the code: var url = "grant_type=password&username=" + $scope.logInfos.loginEmail + "&password=" + $scope.logInfos.loginPassword; var xhr = new XMLHttpRequest(); xhr.open('POST', 'https://myUrl/token'); xhr

How to create something similar to “toast notification” in Android in windows phone 8.1

一世执手 提交于 2019-12-07 11:59:14
问题 I want to create something similar to "toast notification" in Android in windows phone 8.1. What I want is, a text box to be displayed, indicating the user of some events happened ( like "Paired", "Connection Lost"...etc) . But the text box should get dismissed automatically after a few seconds without any user interaction. I have gone through Message Box, and Popup in windows. But both doesn't suite my needs, or I have to use a timer callback to dismiss it automatically, which is not

Android - Create a Toast anchored to a View

时光毁灭记忆、已成空白 提交于 2019-12-07 11:00:43
问题 I want to create a toast that is anchored to a View (i.e., appears next a to given View). I've tried toast.setGravity(0, (int)v.getX(), (int)v.getY()); but this creates it in an entire location entirely. If it matters, my view is an element in a TableRow. Thanks EDIT: I can't use PopupWindow for this task. 回答1: I think this Tutorial will help you to achieve what you want: public void onClick(View v) { int xOffset = 0; int yOffset = 0; Rect gvr = new Rect(); View parent = (View) v.getParent();

How to Change the alignment of Toast by Programmatically? [duplicate]

爱⌒轻易说出口 提交于 2019-12-07 07:49:35
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: how to change position of Toast in android? How to change the Alignment for Toast? Basically, toast it'll displays information bottom of the device. How can we change that? Anyone help me to find out this? Thanks in Advance. 回答1: It would be a nice idea to create a Custom Toast like this, TextView textview = new TextView(context); textview.setText(text); textview.setBackgroundColor(Color.GRAY); textview

Toast Notification issue with recent device update in Android

牧云@^-^@ 提交于 2019-12-07 06:50:24
问题 This post is related to the existing filed bug: https://groups.google.com/forum/#!topic/android-developers/K7pjy3Gm5Lk/discussion Apparently, in some devices after a system update, the toasts are not shown. The problem happens when in preferences, for your application the notifications checkbox is unchecked. Due to that your all the toasts of your app will be hidden. This happened to me on a Samsung galaxy tab 2 but it can happen on other devices: Toast Notifications Not Showing Up on Nexus 7

how can I find the layout parameters of the toast widget?

纵饮孤独 提交于 2019-12-07 06:43:02
问题 I like the layout of the toast widget very much, that means rounded corners, transparency, light grey border. Is there any way to see the layout parameters of such android standard widgets like the toast ? I would like do define a TextView with the same layout parameters. 回答1: The layout can be found under {SDKBASEDIR}/platforms/{RELEASE}/res/layout/transient_notification.xml e.g. for 2.1: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill

Suppressing toast from package in Android

余生长醉 提交于 2019-12-06 23:26:29
问题 I'm developing an Android app and I'm trying to show some information with a Toast . I used Toast s in other projects and everything works, but in this app, when the Toast should appear, it doesn't do it and Logcat shows the next message: Suppressing toast from package com.xxxxxxx by user request. I'm creating the toast with the next code: Context context = xxxxxxx.this; CharSequence text = "Hello toast!"; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration

Android按钮绑定四种方式

雨燕双飞 提交于 2019-12-06 23:08:26
public class MainActivity extends Activity implements OnClickListener{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //点击方式1 Button but1=(Button)findViewById(R.id.button1); but1.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Toast.makeText(MainActivity.this, "点击1事件", 800).show(); } }); //点击方式2 Button but2=(Button)findViewById(R.id.button2); but2.setOnClickListener(new MyOnClickListener()); //点击方式3 类上面实现OnClickListener Button but2=(Button)findViewById(R.id.button3)

Android课设报告 123 赵乾

北城余情 提交于 2019-12-06 22:56:27
基于 Android 的天喵购物系统设计与实现 一 ,选题目的及意义 随着智能手机的普及,基于 Android平台的应用软件需求也越来越多。 通过计算机系统的设计与开发,验证和扩展本科前三年所学相关课程的理论知识,在实践中深入理解其中的重点和难点,提高基本理论水平,巩固基础知识体系,掌握计算机系统设计与开发的基本技能,培养灵活运用理论知识分析和解决实际问题的能力。 当下我们处于大数据网络时代,无疑,网上购物脱颖而出,即马云阿里巴巴成立以来,网上购物成为人民日益需求的购物来源,而其简单便捷,足不出户便能买到自己喜欢的物品,深受大众喜爱。所以我在此选题制作天喵购物系统。 使用的技术 (1) UI设计:用于页面设计。 (2) SQLite 数据库:用于购物车功能的实现,并加入增删改查功能。 (3) Activity 组件的应用:用于多 Activity 的切换。 (4) ListView 的使用:用于页面布局。 (5) MD5 算法的使用:用于用户注册。 字段名 数据类型 长度 主键 索引 外键 Name Char 50 是 否 Balance Int 11 否 否 二,系统需求分析 2.1 用户需求 天喵购物系统,可用于电子商务等电商的卖货平台,提供一个网上交易的机会,并支持更新与维护,使用方便,易用性强。该系统实现的大致功能;用户注册登陆。提供了货物信息的查询,添加,修改,删除