PopupWindow的使用
来源:互联网 发布:js get url parameter 编辑:程序博客网 时间:2024/06/10 01:45
1.把需要的布局加载到popupwindow
2.设置popupwindow的大小
3.设置显示的位置
public class CustomPopupWindow extends PopupWindow{ public CustomPopupWindow(View view, int style) { // 设置SelectPicPopupWindow的View this.setContentView(view); // 设置SelectPicPopupWindow弹出窗体的宽 this.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT); // 设置SelectPicPopupWindow弹出窗体的高 this.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); //加入动画 this.setAnimationStyle(style); this.setFocusable(true); this.setOutsideTouchable(true); // 刷新状态 this.update(); ColorDrawable dw = new ColorDrawable(0000000000); this.setBackgroundDrawable(dw); }}
XML动画文件
<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android" > <!-- 定义从透明到可见 --> <alpha android:fromAlpha="1.0" android:toAlpha="0.0" android:duration="5000" /><!--缩放--> <scale android:duration="5000" android:fromXScale="1.0" android:fromYScale="1.0" android:pivotX="50%" android:pivotY="50%" android:toXScale="2.0" android:toYScale="2.0" /> <!--旋转--> <rotate android:duration="5000" android:fromDegrees="360" android:toDegrees="-360" android:pivotX="50%" android:pivotY="50%" /> <!--移动--> <translate android:duration="5000" android:fromXDelta="1080" android:fromYDelta="1920" android:toXDelta="0" android:toYDelta="0" /></set>可以使用了。哈哈哈哈哈我们每一天都要进步哟<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" > <!-- 定义从可见到透明 --> <alpha android:fromAlpha="1.0" android:toAlpha="0.0" android:duration="300" /></set><?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ffffff" android:orientation="vertical"> <TextView android:layout_width="match_parent" android:layout_height="50dp" android:background="#de2323" android:gravity="center" android:text="选择主题" android:textColor="#ffffff" /> <!-- <GridView android:id="@+id/gridview" android:layout_width="match_parent" android:layout_height="wrap_content" android:numColumns="5" android:scrollbars="none"></GridView>--> <TextView android:layout_width="100dp" android:layout_height="50dp" android:layout_gravity="center" android:background="#de2323" android:gravity="center" android:text="取消" android:textColor="#ffffff" /></LinearLayout><!-- PopupWindow动画的效果样式 --><style name="AnimationWindow"> <item name="android:windowEnterAnimation">@anim/pop_in</item> <item name="android:windowExitAnimation">@anim/pop_out</item></style>
1 0
- Android PopupWindow的使用
- Android PopupWindow的使用
- Android PopupWindow的使用!!!
- 关于popupWindow的使用
- PopupWindow的使用
- PopupWindow的使用例子
- PopupWindow的使用
- popupWindow的使用心得
- PopupWindow的使用
- PopupWindow的使用
- Android PopupWindow的使用!!!
- PopupWindow的使用
- PopupWindow的使用
- popupWindow的使用
- PopupWindow的使用
- PopupWindow的使用
- Popupwindow的使用
- PopupWindow的使用
- 第1周 项目(A)-2摄氏度与华氏度转换
- 欢迎使用CSDN-markdown编辑器
- [转]C# ListView 单击标题实现排序(在转载的基础上有所完善)
- [转]解决C# WinForm 中 VSHOST.EXE 程序不关闭的问题
- Java语言知识体系图
- PopupWindow的使用
- Linux的前世今生
- SQL杂记
- 使用AndroidStudio编译NDK的方法及错误解决方案
- SQLServer int转float
- 并发队列ConcurrentLinkedQueue和阻塞队列LinkedBlockingQueue用法
- SQLServer 添加序号列
- Mysql-----case when then else end
- android开发之线程的问题