标签: popupwindow

首先添加一个UIView,甚至是导航栏

我希望在任何其他视图之上显示甚至导航栏,这是一种看起来像这样的"弹出"视图:

  • 全屏黑色背景,0.5阿尔法,以查看UIViewController下面的其他.
  • UIView中间的窗口有一些信息,(如果你想知道一切,日历).

为此,我创建了一个包含两个UIViews(背景和窗口)的UIViewController,我正在尝试显示它.我试过一个简单的[mySuperVC addSubview:myPopUpVC.view],但我仍然有上面的导航栏.

我试图将它作为模态呈现,但是UIViewController底层消失了,我失去了透明效果.

任何想法,我相信这很简单......

谢谢!

uinavigationbar popupwindow uiviewcontroller ios

174
推荐指数
10
解决办法
12万
查看次数

PopupWindow - 在外部点击时关闭

我的活动中有一个PopupWindow,即使我正在与我的活动交互(比如在我的列表上滚动),我的PopupWindow仍会显示.我可以滚动浏览我的列表,PopupWindow仍在那里.

我想要实现的是当我在不是PopupWindow的屏幕上触摸/滚动/点击/等时,我想要关闭PopupWindow.就像菜单的工作方式一样.如果您在菜单外单击,菜单将被取消.

我试过setOutsideTouchable(true)但它不会解雇窗口.谢谢.

android popupwindow android-menu

86
推荐指数
10
解决办法
8万
查看次数

Android PopupWindow处于活动状态时模糊或暗淡背景

当我使用弹出窗口显示时,我希望能够模糊或调暗背景popup.showAtLocation,并在popup.dismiss调用时将背景解开/调暗.

我曾尝试应用布局PARAMS FLAG_BLUR_BEHINDFLAG_DIM_BEHIND我的活动,但这似乎只是一旦我的应用程序开始模糊和朦胧的背景.

如何使用弹出框进行模糊/调光?

android popupwindow android-popupwindow

77
推荐指数
6
解决办法
10万
查看次数

Android弹出窗口被解雇

当我单击列表活动中的项目时,我会显示一个弹出窗口.问题是后退键不会关闭它.我尝试在列表活动中捕获后退键但它没有注册它...然后我尝试将onkeylistener注册到我正在传递到弹出窗口的视图中.像这样:

pop.setOnKeyListener(new View.OnKeyListener() {

        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            // TODO Auto-generated method stub
            boolean res=false;
            if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
                // do something on back.
                Log.e("keydown","back");
                if (pw.isShowing()) {
                    Log.e("keydown","pw showing");
                    pw.dismiss();
                    res = true;
                }
            } else {
                res = false;
            }
            return res;
        }
    });
Run Code Online (Sandbox Code Playgroud)

传递给像这样的弹出窗口:

pw = new PopupWindow(
       pop, 
       240, 
       70, 
       true);
Run Code Online (Sandbox Code Playgroud)

但那个听众既不会开火也不会开火.你能帮助我吗?我没有想法:)

android popupwindow

61
推荐指数
5
解决办法
6万
查看次数

在Android Activity中创建弹出窗口时出现问题

我正在尝试创建一个仅在应用程序第一次启动时出现的弹出窗口.我希望它显示一些文本并有一个按钮来关闭弹出窗口.但是,我在让PopupWindow工作时遇到了麻烦.我尝试了两种不同的方法:

首先我有一个XML文件,它声明了popup.xml的布局(在linearlayout中的textview),我在主Activity的OnCreate()中添加了这个:

PopupWindow pw = new PopupWindow(findViewById(R.id.popup), 100, 100, true);
    pw.showAtLocation(findViewById(R.id.main), Gravity.CENTER, 0, 0);
Run Code Online (Sandbox Code Playgroud)

其次,我使用此代码完全相同:

final LayoutInflater inflater = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    PopupWindow pw = new PopupWindow(inflater.inflate(R.layout.popup, (ViewGroup) findViewById(R.layout.main) ), 100, 100, true);
    pw.showAtLocation(findViewById(R.id.main_page_layout), Gravity.CENTER, 0, 0);
Run Code Online (Sandbox Code Playgroud)

第一个抛出NullPointerException,第二个抛出BadTokenException并说"无法添加窗口 - 令牌null无效"

世界上我做错了什么?我是非常新手所以请耐心等待.

android popupwindow

52
推荐指数
4
解决办法
6万
查看次数

带有Tooltip Arrow的Android PopupWindow

我已经看到很多关于通过将null或新的Drawable()传递给setBackgroundDrawable()来删除PopupWindow边框的问题.我遇到了相反的问题.我想在我的PopupWindow周围有一个边框,最好带有指向我的锚点的工具提示箭头.目前,我的PopupWindow没有边框.我已经尝试调整边距,xml中的背景,布局的宽度和高度,listview和listview行无济于事.有人可以请帮助我在顶部获得边框和图像吗?我试图坚持使用Android SDK.

popup_menu_list.xml

<?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" >

    <com.github.jeremiemartinez.refreshlistview.RefreshListView
        android:id="@+id/popup_menu_list_listview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@color/color_white" />

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

Java的

private void displayPopupMenu() {
        LayoutInflater layoutInflater = getLayoutInflater();
        View popupView = layoutInflater.inflate(R.layout.popup_menu_list, null);        
        final PopupWindow popupWindow = new PopupWindow(popupView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);       
        RefreshListView myListView = (RefreshListView) popupView.findViewById(R.id.popup_menu_list_listview);       
        mAdapter = new myAdapter(this, getAdapterData());       
        myListView.setAdapter(mAdapter);            
        popupWindow.showAsDropDown(mMyAnchor);      
    }
Run Code Online (Sandbox Code Playgroud)

我只是抓住这些作为例子,但我想要这样的东西弹出指向锚点:

在此输入图像描述

但我得到这样的东西:

在此输入图像描述

android popupwindow

50
推荐指数
3
解决办法
8万
查看次数

onAnimationEnd没有被调用,onAnimationStart工作正常

我在PopupWindow中有一个ScrollView.我正在使用TranslateAnimation为ScrollView内容设置动画.

动画启动时,会调用onAnimationStart侦听器,但不会调用onAnimationEnd.有任何想法吗 ?

布局:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:background="@drawable/popup_window_bg"
   android:layout_width="match_parent"
   android:layout_height="wrap_content">
  <View
     android:layout_width="@dimen/toolbar_padding_left"
     android:layout_height="@dimen/toolbar_height"/>
  <ScrollView
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+web/toolbar"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:scrollbars="none"
     android:visibility="invisible">
    <LinearLayout
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:orientation="vertical">

       ...

    </LinearLayout>
  </ScrollView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

动画代码:

mToolbar = mPopupContents.findViewById( R.web.toolbar );
TranslateAnimation anim =
    new TranslateAnimation(0, 0, -60, 0);
anim.setDuration(1000);
anim.setAnimationListener(new Animation.AnimationListener() {
        public void onAnimationStart(Animation a) {
            Log.d(LOGTAG, "---- animation start listener called"  );
        }
        public void onAnimationRepeat(Animation a) {}
        public void onAnimationEnd(Animation a) {
            Log.d(LOGTAG, "---- animation end listener called"  );
        }
    }); …
Run Code Online (Sandbox Code Playgroud)

animation android popupwindow

46
推荐指数
4
解决办法
3万
查看次数

如何在Android中创建弹出窗口(PopupWindow)

要创建一个简单的工作PopupWindow,我们需要执行以下操作:

popup_example.xml:

<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:padding="10dip"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">

        <TextView         
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dip"
            android:text="Test Pop-Up" />

    </LinearLayout>
Run Code Online (Sandbox Code Playgroud)

Java代码

LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 

PopupWindow pw = new PopupWindow(inflater.inflate(R.layout.popup_example, null, false),100,100, true);

pw.showAtLocation(this.findViewById(R.id.main), Gravity.CENTER, 0, 0);
Run Code Online (Sandbox Code Playgroud)

我的要求是我需要一个

<TEXTVIEW android:layout_height="wrap_content" android:layout_width="fill_parent" />
Run Code Online (Sandbox Code Playgroud)

和a

<BUTTON android:id="@+id/end_data_send_button" android:text="Cancel"/>
Run Code Online (Sandbox Code Playgroud)

在我的popup_example.xml.如何在Java代码中处理这两个组件?

截图

android popupwindow android-popupwindow

45
推荐指数
5
解决办法
17万
查看次数

ListPopupWindow不遵守WRAP_CONTENT宽度规范

我正在尝试使用ListPopupWindow来显示一个字符串列表ArrayAdapter(最终这将是一个更复杂的自定义适配器).代码如下.如屏幕截图所示,结果ListPopupWindow似乎表现为内容宽度为零.它显示了正确数量的项目,这些项目仍然可以点击,并且点击成功生成了一个项目Toast,因此至少可以正常工作.

一个有趣的说明:我可以提供宽度(以像素为单位)popup.setWidth(...)而不是ListPopupWindow.WRAP_CONTENT它会显示一些内容,但这似乎非常不灵活.

如何ListPopupWindow包装其内容?

测试活动:

public class MainActivity extends Activity {

    private static final String[] STRINGS = {"Option1","Option2","Option3","Option4"};
    private View anchorView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getActionBar().setHomeButtonEnabled(true);
        setContentView(R.layout.activity_main);
        anchorView = findViewById(android.R.id.home);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                showPopup();
                return true;
        }
        return super.onOptionsItemSelected(item);
    }

    private void showPopup() {
        ListPopupWindow popup …
Run Code Online (Sandbox Code Playgroud)

user-interface android popupwindow

37
推荐指数
4
解决办法
1万
查看次数

在用户单击ajax调用后打开没有弹出窗口阻止程序的新选项卡

我有一个页面,使用户能够通过HTML5画布执行图像处理,在页面上,有一个Facebook分享按钮,用于在Facebook上共享生成的画布图像.

单击链接时,会向服务器(ASP.NET MVC)发送ajax请求以执行映像生成,将映像保存在服务器上,然后生成作为ajax返回的URL(链接到映像)响应.返回的url是我想要传递的Facebook要分享的参数.问题是,当我调用"window.open"时,弹出窗口阻止程序阻止了facebook共享对话框.

有没有其他方法可以在没有弹出窗口阻止程序的情况下打开新选项卡.我相信,既然用户发起了动作,我应该有办法绕过弹出窗口拦截器.谢谢.

javascript popupwindow popup-blocker

37
推荐指数
3
解决办法
6万
查看次数