android基础---->Toast的使用
简要说明
Toast是一种没有交点,显示时间有限,不能与用户进行交互,用于显示提示信息的显示机制,我们可以把它叫做提示框。Toast不依赖 于Activity,也就是说,没有Activity,依然可以使用Toast。
Android的四大组件:Activity, Service, Broadcast Receiver, Contet
Provider,都是继承Context的(Context,现在大家称之为上下文,之前又被翻译为句柄),包括整个Application也是继承于Context的。Toast就是依赖于应用程序Application的Context。
项目结构
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAATEAAAD7CAIAAACNAzRZAAAV/klEQVR4nO2dzW8c533H96/orRcfeuqlhxYaoDUMNUGFBvbJKJDmUhjtHOKTYJCIrFa0gcJOnHgQNICUWAlsJK1VQ94XdamhtKVlmyQsC6RFU5Ipa6kXIOJqBUQ2qRVX9jYinh5md+Z5nXlmOLv74+z3gwG8MzvPM8+u56Pnmdl5vizNzc2dP3/+5MmTDABAgBKcBIAUOTv5wfEXpOX28plcagZgQhi6k9ASgFSMwkntksvhApqeUyo5XpNWVWpt+VYOiorGydnZ2bKOer2eWN1YnPTdUl7neo5VqbXlWzkoKhonW62W1slWq5VYnY1vhn18tzTA9YM+peT6jDEmrkg7cmvhLvy2QamgDsdr9t90vGa0YyCKbVX9uviiyQ2Lr1wSl68k8TsHBUM/dm00GpKQjUbDprqsTgpnbJyTvA56J8WqSmJBx+Fs4l6XHK9pXZW83aphiZW7vr4Su/+PoDjonex0OpVKJRSyUql0Oh2b6myc3Lz24ea1D4VNwfkZ9kOMGZ3Ujf+EbUFV6lr/dBf84Vc425Kq0h46sWHayoOjhheaGN2CmHs8S0tLoZOLi4uW1cU4efjURWkJ3xLHpuomfoXrXoTTu78SDlH5aiIn+28I/wbwK1ZVSd2ZOvLVNUxbudJRaioBk4bRyV6vV61Wg06y1+tZVrcXJzX9pE6haIO27xT3jdbSO2mqir99KndsMQ2LFV5ArARMGnG/hayurpbL5bW1NfvqsjmpuZ40XcvpLuWibcnXkzZOJlSldHHC7SJzw+IrN346MGkk/D45Pz+fqjrTLx+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ArMtRBaug6OZKMrL6UTc/h+ks10irJSaN6gd0wE6SAopMjzMhirOk5jusOlDREWvFO8vJGEa/clWV/T0933QlAIrScHHlGFlNS47SRVtF91/Bt7l39/RyEnINs0HIyM8PPyAJgRBTESQAKA5wEgBZwEgBawEkAaAEnAaAFnASAFv8P5Nka5aoUOQIAAAAASUVORK5CYII=" alt="" />
代码实现
- MainActivity.java:
package com.example.linux.customtoasttest; import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast; /**
* writer: 胡红翔
* function: 自定义toast,以及toast的简单使用
*/
public class MainActivity extends AppCompatActivity { @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
} // toast:位置的改变
public void toast1(View view) {
Toast toast = Toast.makeText(MainActivity.this, "toast", Toast.LENGTH_LONG);
toast.setGravity(Gravity.BOTTOM | Gravity.LEFT, 0, 0);
toast.show();
} //toast:自定义Toast
public void customToast(View view) {
LayoutInflater inflater = getLayoutInflater();
ViewGroup viewGroup = (ViewGroup) findViewById(R.id.toast_layout_root);
View layout = inflater.inflate(R.layout.toast_layout, viewGroup); TextView text = (TextView) layout.findViewById(R.id.textView);
text.setText("This is a custom toast"); Toast toast = new Toast(MainActivity.this);
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
toast.setDuration(Toast.LENGTH_LONG);
toast.setView(layout); // 自定义View
toast.show();
}
}
- activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.linux.customtoasttest.MainActivity"> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!" /> <Button
android:text="ToastPosition"
android:onClick="toast1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" /> <Button
android:text="CustomToast"
android:onClick="customToast"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
- toast_layout.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toast_layout_root"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#DAAA"
android:orientation="horizontal"
android:padding="8dp"> <ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="8dp"
android:src="@mipmap/ic_launcher" /> <TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFF" />
</LinearLayout>
实现原理
- toast的makeText方法:得到一些信息,生成一个View
Toast result = new Toast(context);
LayoutInflater inflate = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflate.inflate(com.android.internal.R.layout.transient_notification, null);
TextView tv = (TextView)v.findViewById(com.android.internal.R.id.message);
tv.setText(text); result.mNextView = v;
result.mDuration = duration; return result;
- toast的show方法:这个比较难,表示没怎么看懂,后续再做补充。大概的是add(view)让上述view显示,开启了一个线程不断轮询(估计是duration),启动了一个通知服务。
// 窗口管理类
mWM = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
......
mWM.addView(mView, mParams);
// 绑定事件
trySendAccessibilityEvent();
友情链接
android基础---->Toast的使用的更多相关文章
- Android基础工具类重构系列一Toast
前言: 一直在考虑写一下Android实际项目中的一些总结,翻看CSDN博客,上一篇已经是一年多曾经. 本系列定位Android基础工具类重构.旨在记录实际项目中经经常使用到的一些工具类,比方Toas ...
- <Android 基础(十六)> Toast
介绍 A toast provides simple feedback about an operation in a small popup. It only fills the amount of ...
- 基础4 Android基础
基础4 Android基础 1. Activity与Fragment的生命周期. Activity生命周期 打开应用 onCreate()->onStart()->onResume 按BA ...
- 【Android基础】listview控件的使用(3)------Map与SimpleAdapter组成的多显示条目的Listview
前面介绍的两种listview的使用都是最基础的,所以有很大的局限性,比如只能在一个item(即每一行的条目)中显示一个文本信息,这一篇我将介绍Map与SimpleAdapter组成的多显示条目的Li ...
- Android开发Toast Notifications
Android开发Toast Notifications 关键类 Toast toast通知是一种在窗口表面弹出的消息.它只占用信息显示所需的空间,用户当前的activity仍保持可见并可交互.该通知 ...
- 安卓四大组件之Sevice组件的简单使用 --Android基础
1.本例实现了简单的Service(服务)的创建.启动和停止,点击“启动SERVICE”页面会显示“服务被创建”,接着是“服务被启动”.点击“停止SERVICE”页面提示“服务被停止”.太过基础,直接 ...
- android基础---->AIDL服务的使用
AIDL和其他的IDL类似,它允许你定义程序接口,以便客户端与服务器端通过IPC机制交互.在android上面,一个进程一般不能访问另外进程的内存.因此,Android平台将这些跨进程访问的对象分解成 ...
- Android基础新手教程——3.1 基于监听的事件处理机制
Android基础新手教程--3.1.1 基于监听的事件处理机制 标签(空格分隔): Android基础新手教程 本节引言: 第二章我们学习的是Android的UI控件,我们能够利用这些控件构成一个精 ...
- Android基础新手教程——4.1.2 Activity初窥门径
Android基础新手教程--4.1.2 Activity初窥门径 标签(空格分隔): Android基础新手教程 本节引言: 上一节中我们对Activity一些主要的概念进行了了解,什么是Activ ...
随机推荐
- 初学Django基础02 ORM操作
django的ORM操作 之前我们知道了models.py这个文件,这个文件是用来读取数据结构的文件,每次操作数据时都走这个模块 常用字段 AutoField int自增列,必须填入参数 primar ...
- 怎样在一条sql语句中将第一列和第二列加和的值作为第三列的值
今天在写代码的时候,遇到的一个小问题,特意记下来,以免自己以后忘记了. 在一个表单里面,要表单的第一列和第二列的值查询出来,做和,作为第三列的值. select 1 as a,2 as b,(a+b) ...
- hdu6172&&hdu6185&&P5487——BM算法
hdu6172 模板的简单应用 先根据题中的表达式求出前几项,再上BM,注意一下n的大小关系. #include <bits/stdc++.h> using namespace std; ...
- 集成omnibus-ctl 开发一个专业的软件包管理工具
前边有转发过来自chef 团队的一篇omnibus-ctl 介绍文章,以下尝试进行项目试用 就是简单的集成,没有多少复杂的操作 环境准备 ruby ruby 使用2.6.3 使用 rbenv 安装,可 ...
- 训练集,验证集,测试集(以及为什么要使用验证集?)(Training Set, Validation Set, Test Set)
对于训练集,验证集,测试集的概念,很多人都搞不清楚.网上的文章也是鱼龙混杂,因此,现在来把这方面的知识梳理一遍.让我们先来看一下模型验证(评估)的几种方式. 在机器学习中,当我们把模型训练出来以后,该 ...
- THUWC2020 划船记
PS:THUWC2020在2019年 Day 1 考场外的太懒了不写了. 三题题目大意: T1: T2: 给定一个\(n(\leq 10^5)\)个结点的有向图,每条边有个limit,表示经过这条边l ...
- Day17:web前端开发面试题
1.JavaScript 数据类型有哪些? JavaScript 变量能够保存多种数据类型:数值.字符串值.数组.对象等等: var length = 7; // 数字 var lastName = ...
- avalon $computed不起作用?
computed写的个数,应该是只能一个的,之前写了两个,一个是空,一个里面有数据,那个有数据的不起作用,但是在有数据的里面写一个一个console.log就会起作用,所以将多余的空的computed ...
- vue on-change 如果有循环的timer 则无限自动执行
<div class="contract-class"> <Checkbox v-model="smallChecked" :on-chang ...
- 第09组 Alpha冲刺(1/4)
队名:软工9组 组长博客: https://www.cnblogs.com/cmlei/ 作业博客: 组员进度 ● 组员一(组长) 陈明磊 ○过去两天完成了哪些任务 ●文字/口头描述 初步 ...