如何在android中为弹出窗口创建一个Drop Shadow?

时间:2014-06-28 17:10:05

标签: android

如何为用户点击按钮时弹出的图像创建投影?

这是弹出窗口的代码(图片)

@Override
         public void onClick(View arg0) {
             View popupView = new View(CharlieDavid.this);
             final PopupWindow popupWindow = new PopupWindow(popupView,
             ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
             Drawable drawable = getResources().getDrawable(R.drawable.charlie_a);

             popupWindow.setBackgroundDrawable(drawable);
             popupWindow.setHeight(664);
             popupWindow.setWidth(500);      
             popupWindow.setTouchable(true);
             popupWindow.setFocusable(true);
             popupWindow.setShadowLayer(5.5f, 4.0f, 4.0f, Color.BLACK); <---The method setShadowLayer(float, float, float, int) is undefined for the type PopupWindow
             popupWindow.setTouchInterceptor(new View.OnTouchListener() {

但现在我在setShadowlayer下遇到错误。我做错了什么?

0 个答案:

没有答案