我正在尝试添加双击列表视图项目...
这是我简单的尝试
这里我没有得到代码中的实际问题......
//手势探测器上的消息 不推荐使用构造函数GestureDetector(GestureDetector.OnGestureListener)
1.数据加载
setListData();
Resources res=getResources();
log_adapter = new Logadapter(screen,arr_list,res);
list.setAdapter(log_adapter);
手势检测器(检测双击)
gestureScanner = new GestureDetector(this);
gestureScanner.setOnDoubleTapListener(new OnDoubleTapListener(){
public boolean onDoubleTap(MotionEvent e) {
LayoutInflater inflater = (LayoutInflater)screen.getSystemService(screen.LAYOUT_INFLATER_SERVICE);
layout = inflater.inflate(R.layout.snap_log_viewer,null);
AlertDialog.Builder builder = new AlertDialog.Builder(SnapLog_Activity.this);
builder.setView(layout);
AlertDialog alertDialog = builder.create();
alertDialog.show();
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
Window window = alertDialog.getWindow();
lp.copyFrom(window.getAttributes());
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
window.setAttributes(lp);
return true;
}
public boolean onDoubleTapEvent(MotionEvent e) {
LayoutInflater inflater = (LayoutInflater)screen.getSystemService(screen.LAYOUT_INFLATER_SERVICE);
layout = inflater.inflate(R.layout.snap_log_viewer,null);
AlertDialog.Builder builder = new AlertDialog.Builder(SnapLog_Activity.this);
builder.setView(layout);
AlertDialog alertDialog = builder.create();
alertDialog.show();
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
Window window = alertDialog.getWindow();
lp.copyFrom(window.getAttributes());
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
window.setAttributes(lp);
System.out.println("log1");
return false;
}
public boolean onSingleTapConfirmed(MotionEvent e) {
return false;
} });
错误在哪里...... 布局显示为null ... 调试.....