开发学院手机开发Android 开发 Android View 拖动&插入 研究 阅读

Android View 拖动&插入 研究

 2010-07-01 14:10:00 来源:WEB开发网   
核心提示:ImageView iv = (ImageView)lLayout.getChildAt(i);ImageView iv2 = (ImageView)lLayout.getChildAt(i+1);if(iv.getTop()< v.getTop() && iv2.getTop() > v.getTop()

ImageView iv = (ImageView)lLayout.getChildAt(i);

ImageView iv2 = (ImageView)lLayout.getChildAt(i+1);

if(iv.getTop()< v.getTop() && iv2.getTop() > v.getTop()){

//refer delta of point1 & point2

if(point1 < point2){//drag to bottom

return i+1;

}

else {//drag to up

return i+1;

}

}

}

//otherwise return last location

return lLayout.getChildCount()-1;

}

public int getLocation(View v){

for(int i=0;i< p>

ImageView iv = (ImageView)lLayout.getChildAt(i);

ImageView iv2 = (ImageView)lLayout.getChildAt(i+1);

if(iv.getTop()< v.getTop() && iv2.getTop() > v.getTop()){

//refer delta of point1 & point2

if(point1 < point2){//drag to bottom

return i+1;

}

else {//drag to up

return i+1;

}

}

}

//otherwise return last location

return lLayout.getChildCount()-1;

}

5. emulator 运行截图:

- 拖拉前:

- 拖拉后:

上一页  1 2 3 4 

Tags:Android View 拖动

编辑录入:coldstar [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接