前言:因为Android 没有像IOS一样的ActionSheet,虽然在github上看到有一些类似ActionSheet的库,总觉得不好用,不如自己写一个弹框通用类,样式全部自已来多好. Step 1 废话不多说,直接上代码. public class CustomPopWindow implements PopupWindow.OnDismissListener{ private static final String TAG = "CustomPopWindow"; priva
代码完全复制:https://github.com/pinguo-zhouwei/CustomPopwindow 使用参考:上面的github地址 1.封装类 /** * * 自定义PopWindow类,封装了PopWindow的一些常用属性,用Builder模式支持链式调用 * Created by zhouwei on 16/11/28. */ public class CustomPopWindow implements PopupWindow.OnDismissListener{ pri
本文同步自http://javaexception.com/archives/76 背景: 这几天做一个复制文本的需求,突然看到QQ上复制昵称跟QQ号的效果,觉得很不错,就想要模仿一波,办法比较简单粗暴,反编译QQ获取了那个.9图片,然后就是用PopWindow实现了. 解决办法: 自定义PopWindow public class CopyContentPopWindow extends PopupWindow { private final View content; TextView tv
使用PopupWindow来实现弹出框,并且带有动画效果 首先自定义PopupWindow public class LostPopupWindow extends PopupWindow { public Lost lost; public void onLost(Lost lost){ this.lost = lost; } private View conentView; public View getConentView() { return conentView; } public L
public class RollActivity extends Activity { private View view; private Button btn; private PopupWindow mPopupWindow; private View[] btns; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { s
public class RollActivity extends Activity { private View view; private Button btn; private PopupWindow mPopupWindow; private View[] btns; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { s