1

public void done(View 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つの画像しか表示されないことです。しかし、その行のコメントを作成すると、スクロール ビューが機能せず、それらの 4 つの画像のみが表示されます。ポップアップウィンドウをスクロール可能にし、他のすべてのウィンドウを無効にしたい。

4

0 に答える 0