您可以試用滑動抽屜。
或者對於這種動畫,您需要一個佈局,放置在底部並添加一個onThumbTouchListener。因爲這是我起訴我的要求
像這樣的事情
OnTouchListener onThumbTouch = new OnTouchListener()
{
@Override
public boolean onTouch(View v, MotionEvent event)
{
switch(v.getId())
{
case R.id.slider_thumb_id:
{
switch(event.getAction())
{
case MotionEvent.ACTION_MOVE:
{
if(v.getTop()>=0 && v.getBottom()<sliderFrame.getMeasuredHeight()){
int topPos = (int)event.getRawY()-(v.getHeight()*2+v.getHeight());
if(topPos < 0) {
topPos=0;
} else if(topPos > (sliderFrame.getMeasuredHeight()-v.getMeasuredHeight())){
topPos = (sliderFrame.getMeasuredHeight()-v.getMeasuredHeight()) -1;
}
iconParams.topMargin = topPos;
v.setLayoutParams(iconParams);
sliderThumbFake.setLayoutParams(iconParams);
}
break;
}
case MotionEvent.ACTION_UP:
{
}
}
break;
}
}
return true;
}
};
case語句中的代碼可能不會有用。但是,你如何做一個視圖拖動。
滑動抽屜是要走的路。謝謝 – Edgar