listpopupwindow和popupwindow
来源:互联网 发布:渲染软件哪个好 编辑:程序博客网 时间:2024/05/06 22:09
listpopupwindow
mListPopupWindow = new ListPopupWindow(mActivity);
mListPopupWindow.setAdapter(new NavAdapter(mActivity, itmes));mListPopupWindow.setWidth(DisplayUtils.getScreenWidthPixels(mActivity) / 2);
mListPopupWindow.setHeight(DisplayUtils.getScreenWidthPixels(mActivity) * 3 / 5);
mListPopupWindow.setAnchorView(titleTv);
mListPopupWindow.setVerticalOffset(titleTv.getHeight() / 2);
mListPopupWindow.setBackgroundDrawable(mActivity.getResources().getDrawable(R.drawable.popover_background));
mListPopupWindow.setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss() {
titleIv.setImageResource(R.drawable.navigationbar_arrow_down);
}
});
mListPopupWindow.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
ToastUtils.showToast(mActivity, "点击了" + itmes.get(position).getName(), 1000);
}
});
popupwindow
if (mPopupWindow == null) {
view = this.getLayoutInflater().inflate(R.layout.popupwindow_nav, null);
lv_group = (ListView) view.findViewById(R.id.lvGroup);
// 加载数据
itmes = new ArrayList<>();
itmes.add(“首页”);
itmes.add(“我的微博”);
itmes.add(“我的分组”);
lv_group.setAdapter(new NavAdapter(this, itmes));
int width = DisplayUtils.getScreenWidthPixels(this) / 2;
int height = DisplayUtils.getScreenHeightPixels(this) / 2;
// 创建一个PopuWidow对象
mPopupWindow = new PopupWindow(view, width, height);
// 设置允许在外点击消失
mPopupWindow.setOutsideTouchable(true);
}
// 这个是为了点击“返回Back”也能使其消失,并且并不会影响你的背景
mPopupWindow.setBackgroundDrawable(new ColorDrawable(0));
// 显示的位置为:屏幕的宽度的一半-PopupWindow的高度的一半
// int xPos = DisplayUtils.getScreenWidthPixels(mActivity) / 2
// - mPopupWindow.getWidth() / 2;
mPopupWindow.setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss() {
// titleIv.setImageResource(R.drawable.navigationbar_arrow_down);
}
});
lv_group.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
// ToastUtils.showToast(this, "点击了" +
// itmes.get(position), 1000);
}
});
mPopupWindow.showAsDropDown(iv_add); 或者 mPopupWindow.showatLocation();
mPopupWindow.setFocusable(true);
目前Fragment里调用PopupWindow会出现 设置PopupWindow的大小无效的情况,尚未解决!!!
- listpopupwindow和popupwindow
- ListPopupWindow的使用:popupwindow加载listview
- ListPopupWindow
- ListPopupWindow 和 PopupMenu的使用
- ListPopupWindow,PopupMenu
- ListPopupWindow用法
- Android开发笔记(一百二十一)列表弹窗PopupMenu和ListPopupWindow
- Android开发笔记(一百二十一)列表弹窗PopupMenu和ListPopupWindow
- Android开发笔记(一百二十一)列表弹窗PopupMenu和ListPopupWindow
- PopupWindow和按键消息
- android PopupWindow和Activity
- PopupWindow和AlertDialog区别
- popupwindow和listview
- Dialog和Popupwindow
- PopupWindow和AlertDialog区别
- PopupWindow和AlertDialog区别
- PopupWindow和PopupMenu
- 自定义PopupWindow和AlertDialog
- Qt显示界面旋转
- iOS提交后申请加急审核
- HDU 2441
- slab着色
- ceph 添加/移除osd 设备
- listpopupwindow和popupwindow
- DevExpress 15.1.8重大变化说明及下载
- mysql统计一年中每周的数据
- Add Two Numbers
- spring prototype怎么注入到singleton 里面
- 谈谈 React Native
- Linux下杀死进程(kill)的N种方法
- 利用反射机制创建新类的两种方式及比较
- Linux Epool 使用学习笔记