Android基础TOP4:Tost的使用
2024-08-30 22:55:04
Activity:
<RelativeLayout 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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.top4.MainActivity" > <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" /> </RelativeLayout>
JAVA:
View view=getLayoutInflater().inflate(R.layout.activity_main,null);
//定义一个Toast
Toast ts=new Toast(this);
//将该Tosat输出到 View
ts.setView(view);
//设置Toast时间
ts.setDuration();
//设置Tost的位置
ts.setGravity(Gravity.BOTTOM|Gravity.RIGHT,,);
//最后要记得加.show();不加就不会显示
ts.show();
最新文章
- Textbox.Visible=False隐藏方式导致的问题
- Reverse-Daily(2)-wow
- LINUX常用配置及命令
- IntelliJ IDEA 中集成使用git(2015年06月10日)
- js图片旋转
- 常用数据字典---bai
- symfony配置
- HBase API详解
- My网页
- webservice整合spring
- [JLOI2014] 松鼠的新家
- Dynamics CRM2011/2013 删除个人视图
- P4013 数字梯形问题 网络流
- luoguP1919 A*B Problem升级版 ntt
- PL/SQL学习笔记之数据类型中的标量、LOB
- Effective Java通用设计
- Azure ARM (22) 使用Azure PowerShell创建Azure RM VM
- nginx-https错误
- npm的用户名添加不上的原因
- PHP &#183; MySQL函数
热门文章
- [bzoj1582][Usaco2009 Hol]Holiday Painting 节日画画_线段树
- codevs——1979 第K个数
- MYSQL中有关表的简单操作
- 9、Java并发性和多线程-线程安全与共享资源
- mysql模糊查询语句
- ubuntu How do I configure proxies without GUI?
- How to Use DHCP Relay over LAN? - DrayTek Corp
- HDU 1248寒冰王座-全然背包或记忆化搜索
- error: &;#39;Can&;#39;t connect to local MySQL server through socket &;#39;/var/lib/mysql/mysql.sock&;#39; (2)&;#39;
- Oracle 用户管理(二)