popupwindow

popupWindow在android7.0以上显示全屏的问题

匿名 (未验证) 提交于 2019-12-03 00:40:02
在Android7.0以上版本调用popupWindow的showAsDropDown()方法,始终显示全屏,或者遮蔽标题栏目, 解决方案: package com . example . view ; import android . content . Context ; import android . graphics . Rect ; import android . os . Build ; import android . util . AttributeSet ; import android . view . View ; import android . widget . PopupWindow ; /** * @author che on 2018/7/06. */ public class CommonPopWindow extends PopupWindow { public CommonPopWindow ( Context context ) { super ( context ); } public CommonPopWindow ( View contentView , int width , int height ) { super ( contentView , width , height ); } /** * 在android7.0上

与popupwindow有关的坑,Activity A打开B,B调起popupwindow,B会瞬间透明并且看到A?

匿名 (未验证) 提交于 2019-12-03 00:39:02
<item name="android:windowIsTranslucent">true</item> 之前为了在另外的控件上达到透明效果,在activity的theme上增加了上面这个参数,由于对应的theme是全局的,改变了所有引用这个theme的activity。现在好了问题找到了,解决办法就是找到对应的theme去掉这个参数,或者新建个theme给需要弹popupwindow的activity用就可以了。 另外在还出现个问题,B调起过popupwindow过后,返回到A,在这个过程会出现短暂的黑屏,这个网上有解决方法: PS:我在退出时,又Add了一次,能不黑屏吗? 记录一下,免得下次又踩到这个坑里了! 文章来源: 与popupwindow有关的坑,Activity A打开B,B调起popupwindow,B会瞬间透明并且看到A?

Android7.0 popupwindow showAsDropDown 无效解决方法

匿名 (未验证) 提交于 2019-12-03 00:34:01
试了网上查看的很多方法。。 就这个生效了。 if ( Build . VERSION . SDK_INT < 24 ) { popupwindow . showAsDropDown ( mToolbar ); } else { Rect visibleFrame = new Rect (); mToolbar . getGlobalVisibleRect ( visibleFrame ); int height = mToolbar . getResources (). getDisplayMetrics (). heightPixels - visibleFrame . bottom ; popupwindow . setHeight ( height ); popupwindow . showAsDropDown ( mToolbar , 0 , 0 ); } 转载请标明出处: Android7.0 popupwindow showAsDropDown 无效解决方法 文章来源: Android7.0 popupwindow showAsDropDown 无效解决方法

PopupWindow 中含有EditText 长按不弹窗上下文菜单

匿名 (未验证) 提交于 2019-12-03 00:34:01
PopupWindow 中含有EditText 长按不弹窗上下文菜单,在项目中有一个类似发表评论的界面,初始使用的是popupWindows去加载的这个布局,但是后来发现 布局中的 EditText 长按并没有出现上下文菜单,后来查找资料发现这应该是Android 的bug. https://issuetracker.google.com/issues/36984016 使用DialogFragment代替PopupWindows 去实现布局,在Fragment中EditText 中不存在此现象的bug,能够正常的弹出上下文菜单布局。 文章来源: PopupWindow 中含有EditText 长按不弹窗上下文菜单

How to make items clickable in list view?

十年热恋 提交于 2019-12-03 00:28:38
I have been trying to search for a solution, but with very little success. I have to display a pop up window containing a list of items. I was able to display the window but onitemclicklistener is not being called upon clicking an item in the list view . Any help with this issue would be greatly appreciated. Thanks Edit1: public class PopUpWindowActivity extends Activity { /** Called when the activity is first created. */ String[] countries = new String[] { "India", "USA", "Canada" }; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LinearLayout ll = new

PopupWindow+调取相机、相册

匿名 (未验证) 提交于 2019-12-03 00:18:01
File path= new File(Environment.getExternalStorageDirectory().getPath() ,"/xiaofei.png"); 在一个点击事件中创建PopupWindow: //PopupWindow View contentView = View.inflate(getActivity(), R.layout.mine_pop_layout,null); PopupWindow window = new PopupWindow(contentView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); //思考:点击外部不消失 /* * new BitmapDrawable():就是一个透明的背景 */ //如果想要设置点击外部窗口消失,,必须2个方法同时使用 window.setBackgroundDrawable(new BitmapDrawable());//给窗口设置一个完全透明的背景图片 window.setOutsideTouchable(true);//设置窗口外部可以触摸 //思考:窗口里面的控件没有响应 //使用一个setFocusable 就可以实现,,,但是一般这2个方法也会同时使用 window

Android PopupWindow

匿名 (未验证) 提交于 2019-12-03 00:18:01
//弹出pop View view = View. inflate (MyMsgActivity. this , R.layout. msg_pop_layout , null ); ////如果想要使用窗口内部的控件,,,必须通过他的视图对象去找 pop_camera = view.findViewById(R.id. pop_camera ); pop_picture = view.findViewById(R.id. pop_picture ); // 创建一个popupwindow的对象 /** * contentView :popup布局转换成的视图对象 * width:窗口显示的宽度 * height:窗口显示的高度 */ window = new PopupWindow(view, ViewGroup.LayoutParams. WRAP_CONTENT , ViewGroup.LayoutParams. WRAP_CONTENT ); //思考:点击外部不消失 /* * new BitmapDrawable():就是一个透明的背景 */ //如果想要设置点击外部窗口消失,,必须2个方法同时使用 window .setBackgroundDrawable( new BitmapDrawable()); //给窗口设置一个完全透明的背景图片 window

PopUpWindow 的使用笔记

匿名 (未验证) 提交于 2019-12-03 00:11:01
最接做需求的时候,碰到了 PopUpWindow,但是也没做过多了解,就是照搬别人的代码改改逻辑。后面视觉看了之后,说让我加一些动画效果,使用起来更加舒服。可是我看别人以前也没有写,于是就开始捣鼓 PopUpWindow。同时也写一篇文章记录下,后续忘了也可以查看。 相关方法解读 1)几个常用的构造方法 我们在文档中可以看到,提供给我们的PopupWindow的构造方法有九种之多,这里只贴实际 开发中用得较多的几个构造方法: public PopupWindow (Context context) public PopupWindow(View contentView, int width, int height) public PopupWindow(View contentView) public PopupWindow(View contentView, int width, int height, boolean focusable) 参数就不用多解释了吧,contentView是PopupWindow显示的View,focusable是否显示焦点 2)常用的一些方法 下面介绍几个用得较多的一些方法,其他的可自行查阅文档: setContentView(View contentView):设置PopupWindow显示的View getContentView()

Display message when user leaves site

蓝咒 提交于 2019-12-02 23:45:29
问题 I'm looking for a way to display a message to the user if he leaves my site after only viewing one page. I found this (http://www.pgrs.net/2008/1/30/popup-when-leaving-website) clever solution, but it has a few flaws: staying_in_site = false; Event.observe(document.body, 'click', function(event) { if (Event.element(event).tagName == 'A') { staying_in_site = true; } }); window.onunload = popup; function popup() { if(staying_in_site) { return; } alert('I see you are leaving the site'); } It

Android 省,市,区选择权

匿名 (未验证) 提交于 2019-12-02 23:34:01
版权声明:大家可以转载,请写明转载申明 https://blog.csdn.net/bzlj2912009596/article/details/90312251 需要WheelView基础控件自行扩展实现逻辑,可直接添加基础控件库,Gradle 依赖: compile 'com.contrarywind:wheelview:4.0.9' 布局: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"> <include layout="@layout/include_pickerview_topbar" android:layout_width="match_parent" android:layout_height="@dimen/pickerview_topbar_height" /> <LinearLayout android:id="@+id/optionspicker" android:layout