禁用Android中的所有外部点击时,水平scrollview在弹出窗口中不起作用

时间:2013-02-28 09:14:28

标签: android

公共无效(查看v)     {

    // Display settings
    Display display = ((WindowManager) mContext
            .getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();

    // The view to show
    View mView = ((Activity) mContext).getLayoutInflater().inflate(
            R.layout.custom_menu_bottom, null);

    // Create popup window to show
    //mPopupWindow = new PopupWindow(mView, LayoutParams.MATCH_PARENT,
            //LayoutParams.WRAP_CONTENT);
    mPopupWindow = new PopupWindow(mView, LayoutParams.MATCH_PARENT,
            100);
    mPopupWindow.setAnimationStyle(R.style.Animations_MenuAnimation);

    mPopupWindow.setWidth(display.getWidth());
    mPopupWindow.setHeight(display.getHeight()/4);
    mPopupWindow.setOutsideTouchable(true);
       mPopupWindow.setFocusable(true);

 mPopupWindow.setTouchable(true);
    mPopupWindow.setBackgroundDrawable(new BitmapDrawable());



    mPopupWindow.showAtLocation(v, Gravity.BOTTOM, 0, 0);
    mPopupWindow.setContentView(mView);





    int i=0;
    HorizontalScrollView hScrollView=(HorizontalScrollView)mView.findViewById(R.id.horizontal_scroll_view5);
     LinearLayout lowLinearLayout = new LinearLayout(mContext);
    if(moodValue.equalsIgnoreCase("like"))
    {
        for(i=0 ;i<postive_smiley.length;i++)
        {

             final ImageView imageView=new ImageView(mContext);

            //imageView.setImageResource(smiley[i]);
            imageView.bringToFront();

            imageView.setBackgroundResource(postive_smiley[i]);
            lowLinearLayout.addView(imageView);

            imageView.setTag(i);
            imageView.getLayoutParams().height =hScrollView.getLayoutParams().FILL_PARENT;
            imageView.getLayoutParams().width=display.getWidth()/4;

            imageView.setOnClickListener(new OnClickListener() {
                public void onClick(View v) 
                {
                    // TODO Auto-generated method stub
                    int s =(Integer) imageView.getTag();
                    String value=positive_values[s];
                    Toast t = Toast.makeText(mContext, "id is "+s + " choice is "+value, Toast.LENGTH_SHORT);
                    t.show();
                    Done.setMood(value);
                    hide();
                    mContext.finish();



                }
            });
        }
        hScrollView.addView(lowLinearLayout);
    }else
    {
            for(i=0 ;i<negative_smiley.length;i++)
            {

                 final ImageView imageView=new ImageView(mContext);

                   //imageView.setImageResource(smiley[i]);
                   imageView.bringToFront();

                    imageView.setBackgroundResource(negative_smiley[i]);
                    lowLinearLayout.addView(imageView);

                    imageView.setTag(i);
                    imageView.getLayoutParams().height =hScrollView.getLayoutParams().FILL_PARENT;
                    imageView.getLayoutParams().width=display.getWidth()/4;

                    imageView.setOnClickListener(new OnClickListener() {
                        public void onClick(View v) {
                            // TODO Auto-generated method stub
                            int s =(Integer) imageView.getTag();
                            String value=negative_values[s];
                            Toast t = Toast.makeText(mContext, "id is "+s + "choice is"+value, Toast.LENGTH_SHORT);
                            t.show();
                            Done.setMood(value);
                            hide();


                        }
                    });
            }
            hScrollView.addView(lowLinearLayout);
    }



}

当我对mPopupWindow.setBackgroundDrawable(new BitmapDrawable())发表评论时,我的所有窗口都会被禁用,但问题是在弹出窗口中,我在horizontal scroll view中设置了图像的数量,而在活动中只有四个图像。但是当我对该行进行注释时,滚动视图不起作用,只有那四个图像可见。我想让我的弹出窗口可滚动,并禁用所有其他窗口。

0 个答案:

没有答案