popupwindow专题

PopupWindow使用和遮挡虚拟按键处理

PopupWindow顾名思义,就是一个弹出窗口。不过特性倒是挺好玩的: 以弹出窗口的形式展示,可以替代系统的dialog。 可以在任意位置出现,并且会浮动在当前窗口的顶部(获取焦点)。 可以用来装载任意的view。 通过设置背景颜色0xaa000000可以实现半透明效果 关于点击消失: 如果需要点击外部消失,只需设置背景,foucs,outSideTouchable。 this.s

getAllAPP+PopupWindow

———————————————————————————————— 先看布局资源 activity_main.xml(就是一个ListView) <ListView xmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/lv_main_apps"android:layout_width=

Android中 popupWindow 点击外部消失的问题 以及其他内容的小总结

Android中PopupWindow的使用是非常常见的弹窗形式,主要得益于其灵活的位置处理。 一、而最难受的地方在于outsideTouchable的处理。 如果你遇到了点击外部不消失/ 点击外部后消失了但是点击事件透传到了Activity/Fragment的控件中,可以参考一下步骤设置: 1. popupWindow.setBackgroundDrawable(new ColorDra

Android PopupWindow 的使用

<pre name="code" class="java"> /*** 弹出选择头像框*/public void showPop(View parent) {/** if (mPop != null) { int[] location = new int[2];* parent.getLocationOnScreen(location); mPop.showAtLocation(parent,*

Android UI:PopupWindow:API

文章目录 类操作 类 PopupWindow 持有一个View对象和一个WindowManager对象,将外部传入的View对象通过WindowManger.addView的方式显示在屏幕上 PopupWindow.OnDismissListener 操作 对PopupWindow的操作 显示操作 boolean    isShowing() void show

PopupWindow 属性,我们的使用的途径

今天看到了,比人写的一个Demo,看到了之后感觉还不错,自己也是仔细的思考了一哈,其实这样的用途也是比较的多的嘛。 使用PopupWindow可实现弹出窗口效果,,其实和AlertDialog一样,也是一种对话框,两者也经常混用,但是也各有特点。下面就看看使用方法。 showAsDropDown的用法属性介绍 首先初始化一个PopupWindow,指定窗口大小参数。(这下面的东西看起来都

Popupwindow 属性设置

1、<item name="android:windowBackground">@android:color/transparent</item>窗口背景色  2、<item name="android:windowFrame">@null</item>Dialog的windowFrame框为无  4、<item name="android:windowIsFloating">

用PopupWindow实现从底部滑出选择菜单

在开发中PopupWindow的弹出效果是必不可少的。许多应用的App都喜欢用到PopupWindow。如:新浪微博客户端、微信客户端、大众点评客户端等等。今天给大家 介绍的是微信客户端里用PopupWindow实现的一种从底部滑出选择菜单的效果。 本实例弹出窗口主要是继承PopupWindow类来实现的弹出窗体,布局可以根据自己定义设计。弹出效果主要使用了translate和alpha

DialogFragment——解决PopupWindow中的输入框无法复制粘贴的问题;Android中的两种弹窗PopupWindow和Dialog的区别。

本文旨在介绍Android中的两种弹窗PopupWindow和Dialog的区别。以及关于写代码的一些思考。 其实之前各类弹窗,都是使用PopupWindow来实现的。因为PopupWindow能实现这些需求,虽然有的时候有些麻烦,比如前面的文章有写到PopupWindow去实现蒙版遮罩的问题。它本身是没有蒙版提供的。 我们项目中使用各种方法去给它增加遮盖层。如今看来确实是有些愚蠢的。我不介意

Android对话框(四)PopupWindow

主布局 <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"an

Android Fragment 之运行PopupWindow提示 token null is not valid; is your activity running?

Android Fragment 之运行PopupWindow提示 token null is not valid; is your activity running? 由于控件未初始化完成,会导致失败,需要在生命周期方法完成后调用。 建议找一个控件,调用 post方法,进行条用。(post方法可以延迟在所有生命周期完成后执行) bt = (Button)findViewById(R.id.

【android】为PopupWindow设置动画效果

首先定义显示效果的动画文件: [html]  view plain copy <?xml version="1.0" encoding="utf-8"?>   <set xmlns:android="http://schemas.android.com/apk/res/android">         <translate             android:f

使用PopupWindow和Activity两种不同的方式实现弹窗效果

分别使用PopupWindow和Activity两种不同的方式来实现仿微信顶部标题栏弹窗的这样一个效果。 一、实现效果图 这里为了演示方便,我将两种方法放在一个应用程序中演示,这个是主界面 虽然两种实现的方式不一样,但是最终的效果图都是差不多的 二、项目结构图 三、详细的编码实现 3.1 主界面的实现 为了演示方便,我这里把两种实现方式分成两个

android 实现点击屏幕其他地方popupwindow消失

Popupwindow如果需要点击空白处自动消失,需要设置两个函数 1、customPopWindow.setFocusable(true);该函数也可以在构造函数中设置,如:mPopupWindow = new PopupWindow(popunwindwow,LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT,true);最后一个参数tr

PopupWindow封装-view上方显示和下方显示

开源地址:http://simple-quickactions.googlecode.com/svn/trunk 本地下载:http://download.csdn.net/detail/u011127787/5724159 package org.example.qberticus.quickactions;import android.content.Context;import a

Android实现带有listview的PopupWindow

图一是没数据时点击标题栏后显示的PopupWindow菜单,图二有数据时点击标题栏后显示的PopupWindow菜单 接下来看看具体实现: 1.布局 activity和PopupWindow多只是简单的listview activity: <ListView android:layout_width="match_paren

PopupWindow展示位置

showAsDropDown anchor下方,左边对齐 showAsDropDown(anchor,xoffset,yoffset) anchor下方,以anchor左边线为x轴x偏移,向右为正;以anchor下边线为y轴y偏移,向下为正 showAsDropDown(anchor,xoffset,yoffset,gravity) g

PopupWindow的使用以及ArrayAdatper.notifyDataSetChanged()无效详解

随时随地技术实战干货,充分利用闲暇时间,请关注源代码社区公众号(ydmsq666)和技术交流群。 Android的对话框有两种:PopupWindow和AlertDialog。它们的不同点在于: AlertDialog的位置固定,而PopupWindow的位置可以随意   AlertDialog是非阻塞线程的,而PopupWindow是阻塞线程的   PopupWindow的位置按

Android popupWindow取消响应back按钮

想实现的效果是,点击返回按钮,popwindow不隐藏。遇到很多问题,PopupWindow 跟我们的 Activity 不一样,因为我们在构造 PW 的时候往往不是继承来的,而是 new 出来的。所以不能使用重写 PW 的 onKeyDown() 之类的方法来截获键盘事件。     试了两种方法:
     首先在 PW 的布局文件(*.xml)中随意选取一个不影响任何操作的 Vie

Dialog, DialogFragment, PopupWindow比较

随着Fragment这个类的引 入,Google官方推荐大家使用DialogFragment来代替传统的Dialog. 1,AlertDialog与DialogFragment before: AlertDialog dialog = new AlertDialog.Builder(this).setTitle("Dialog").setMessage("thisis a dialog").

android PopupWindow的详细说明

今天主要是对PopupWindow的总结,如有不对之处,还请提出。        PopupWindow 说白点就是个弹出框, 和Dialog相似,它的好处是可以根据需要设置自己要弹出的位置;布局更加灵活。 一:PopupWindow的使用步骤 1:先创建一个PopupWindow实例      PopupWindow(View contentView, int width,

Android自定义PopupWindow小例子

PopupWindow是我们开发中的常客之一,使用起来也比较简单方便。写了个最简单地自定义PopupWindow,记录下来,方便以后使用时直接在上面改动就可以。 /*** @param* @author ldm* @description 自定义PopupWindow* @time 2016/9/29 15:26*/public class CustomPopup extends Popu

Android PopupWindow使用报错问题

1. PopupWindow嵌套Spinner报错问题 在PopupWindow中使用Spinner,一点击下拉列表,程序就会崩溃。控制台报错信息如下: Unable to add window -- token android.view.ViewRootImpl$W@c3c9142 is not valid; is your activity running? 解决方式:在Spinner所

Android popupwindow动画的使用

要实现背景虚化的对话框,有三种方式:PopupWindow,DialogFragment 和 Activity。现在先说说PopuWindow的出现和消失的动画设置。 文章参考:Android之Animation动画的使用(一) PopupWindow的进入效果和退出效果,用到style样式。PopupWindow中没有setAnimation方法,只能通过popWindow.setAn

Android popupwindow弹出对话框

今天项目中要用到对话框浮层显示,PopupWindow可以实现该功能。可以自定义view,通过LayoutInflator方法加载自定义的布局。而且加载和退出时都可以自定义动画效果。还能指定显示的位置。效果图如下所示: MainActivity代码: package com.example.popwindow;import android.os.Bundle;import andro

使用PopupWindow + 2个ListView实现仿 美团/淘宝 多级分类菜单效果

本例要实现的是诸如美团/淘宝/百度糯米 多级分类菜单效果。当分类数量非常多时可以考虑采用两级分类,而诸如美团这种表现方式是一个不错的选择。 首先上效果图:      主要代码: 1. PopupWindow初始化过程: [java]  view plain copy popupWindow = new PopupWindow(this);