new AlertDialog.Builder(this);这样写

解决方案 »

  1.   

    http://blog.csdn.net/sunnyfans/article/details/7969288 这里面有解决方案
      

  2.   


    您好,我的是两个popupWindow ,不是alertDialog
      

  3.   

    您好,代码如何, functionsView.findViewById(R.id.voiceLL).setOnTouchListener(new SoundOnTouchDianmingListener(context,data.get(groupPosition),functionsView.findViewById(R.id.voiceLL)));
    public class SoundOnTouchDianmingListener implements OnTouchListener {
    private DianmingActivity activity;
    private PopupWindow recordingSoundWin;
    private AnimationDrawable rocketAnimation; 
    private MediaRecorder recorder;
    private File fileStorage ;   
    private LinearLayout clockLL;
    private TextView clockTextView;
    private Timer timer;
    private List<Visitor> listCard=new ArrayList<Visitor>();
    private Context context;
    private View view;
    public SoundOnTouchDianmingListener(Context context,List<Visitor> listCard,View view){
    this.listCard=listCard;
    this.context=context;
    this.view=view;
    activity=(DianmingActivity)context;
    if(recordingSoundWin==null){
    recordingSoundWin=new PopupWindow(LayoutInflater.from(activity.getParent())
    .inflate(R.layout.popupwindow_recordsound, null),
    LayoutParams.MATCH_PARENT,
    LayoutParams.MATCH_PARENT);
    ImageView rocketImage = (ImageView)recordingSoundWin.getContentView().findViewById(R.id.rocketImage); 
    rocketImage.setBackgroundResource(R.anim.imgchange); 
    rocketAnimation=(AnimationDrawable)rocketImage.getBackground();
    }
    clockLL=(LinearLayout)recordingSoundWin.getContentView().findViewById(R.id.clockLL);
    clockTextView=(TextView)recordingSoundWin.getContentView().findViewById(R.id.clockTextView);
    } public boolean onTouch(View v, MotionEvent event) {
    switch (event.getAction()) {
    case MotionEvent.ACTION_DOWN:
    //显示录音标识
    recordingSoundWin.showAtLocation(view, Gravity.CENTER, 0, 0);
    break;您好,红色部分为报错部分
      

  4.   

    可以参考这个http://blog.csdn.net/androidzhaoxiaogang/article/details/8472695
      

  5.   

    tryrecordingSoundWin.showAtLocation(view, Gravity.CENTER, 0, 0);
    =>
    recordingSoundWin.showAtLocation(v, Gravity.CENTER, 0, 0);