开机广告页面2017流行样式 dialogTheme的popuwindow版本
来源:互联网 发布:c语言经典编程题 编辑:程序博客网 时间:2024/06/05 16:58
不知道为啥,一些看过的东西不经常用,回头就忘记了,而且,忘记的干干净净
下面我们来复习一下popuwindow的知识,就能比较好的解决这个问题
参考资料
http://blog.csdn.net/harvic880925/article/details/49272285
PopDialogActivity
public class PopDialogActivity extends AppCompatActivity implements View.OnClickListener{ private PopupWindow mPopWindow; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_pop_dialog); Button btn = (Button) findViewById(R.id.btn); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showPopupWindow(); } }); } private void showPopupWindow() { View contentView= LayoutInflater.from(PopDialogActivity.this).inflate(R.layout.pop_dialog,null); mPopWindow = new PopupWindow(contentView, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT, true); mPopWindow.setContentView(contentView); ImageView iv1=(ImageView)contentView.findViewById(R.id.dia_iv); iv1.setOnClickListener(this); //显示popupwindow View rootview=LayoutInflater.from(PopDialogActivity.this).inflate(R.layout.activity_pop_dialog,null); mPopWindow.setAnimationStyle(R.style.contextMenuAnim); mPopWindow.showAtLocation(rootview, Gravity.CENTER,0,0); } @Override public void onClick(View view) { int id =view.getId(); switch (id){ case R.id.dia_iv: mPopWindow.dismiss(); break; } }}
pop_dialog
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <!--android:background="#66000000"--> <ImageView android:id="@+id/mm" android:src="@mipmap/xj3" android:layout_width="200dp" android:layout_centerInParent="true" android:layout_height="270dp"/> <ImageView android:id="@+id/dia_iv" android:layout_width="30dp" android:layout_height="30dp" android:layout_alignEnd="@+id/mm" android:layout_alignTop="@+id/mm" app:srcCompat="@mipmap/error"/> <!--dia_iv--></RelativeLayout>
动画属性
context_menu_enter.xml
<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android"> <translate android:duration="@android:integer/config_shortAnimTime" android:fromXDelta="0" android:fromYDelta="100%p" android:interpolator="@android:anim/accelerate_decelerate_interpolator" android:toXDelta="0" android:toYDelta="0"/></set>
context_menu_exit.xml
<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android" > <translate android:duration="@android:integer/config_shortAnimTime" android:fromXDelta="0" android:fromYDelta="0" android:interpolator="@android:anim/accelerate_decelerate_interpolator" android:toXDelta="0" android:toYDelta="100%p" /></set>
styles
<style name="contextMenuAnim" parent="@android:style/Animation.Activity"> <item name="android:windowEnterAnimation">@anim/context_menu_enter</item> <item name="android:windowExitAnimation">@anim/context_menu_exit</item> </style>
在项目中引入popupwindow
mPopWindow.setAnimationStyle(R.style.contextMenuAnim);
勤学苦练,莫荒废终日
阅读全文
0 0
- 开机广告页面2017流行样式 dialogTheme的popuwindow版本
- 开机广告页面2017流行样式 dialogTheme的Activity版本
- 开机广告页面2017流行样式 dialogTheme的dialog版本
- 流行浏览器内核分类及不同版本的样式区别
- 流行浏览器内核分类及不同版本的样式区别
- iOS 开机广告页面实现
- 比较流行的css样式
- android 流行的广告轮番图
- 液晶广告机在广告界被流行的火热
- 类似Popuwindow的实现
- PopuWindow的使用
- popuwindow的使用方法
- popuwindow的动画实现
- PopuWindow
- popuwindow
- popuwindow
- PopuWindow
- 流行的Linux版本有哪些
- 安卓API指南之Intent 和 Intent 过滤器
- apicloud div 滚动到顶部
- iOS中根据视图生成图片,裁剪图片
- 封装的基类activity
- python 读写csv
- 开机广告页面2017流行样式 dialogTheme的popuwindow版本
- Asp.net运行机制
- 读懂MySQL执行计划
- nginx最大并发连接数的思考:worker_processes、worker_connections、worker_rlimit_nofile
- 加入多线程的文件下载程序
- web服务器 http请求返回 不同返回码的 对应 语意
- NOIP2010第一道 ---导弹拦截(摘自洛谷题解)
- VS2013 BCGControlBar 25 遇到的问题记录
- MySQL数据库学习笔记