1

公共无效完成(查看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并且有一次在活动中只看到四个图像。但是,当我进行该行注释时,滚动视图不起作用,只有这四个图像可见。我想让我的弹出窗口可滚动并禁用所有其他窗口。

4

0 回答 0