最新回答 / qq_慕移動7342775
Invalidate同步處理ui,但是如果你繪制復雜,或者滑動過快等因素會導致Invalidate失效的。所以用postInvalidate
2017-03-30
最新回答 / 攻城獅ZSP
1、針對內存溢出問題,不應該傳遞Bitmap,直接傳遞R.drawable.xxx到里面即可;2、攔截問題,修改如下:定義一個TouchSlop<...code...><...code...><...code...>使用這個方法有一個注意點,就是每一個ImageView一定要加一個Clickable.<...code...>
2017-03-16
最新回答 / 慕粉1001595905
case MotionEvent.ACTION_UP:// 手指立刻 int scrollX = getScrollX();// 獲得滑動距離 index = (scrollX + childwidth / 2) / childwidth;// 獲得索引值 if (index < 0) { index = childcount - 1;// 說明已經滑到了最左邊一張圖片 } else if (index > childcount - 1) { index = 0;/...
2017-03-09
最新回答 / 蘇大人V
你不能直接Toast.makeText(context,pos,Toast.LENGTH_SHORT).show();因為pos是int型,它會被當成資源ID操作也就是類似于drawable、mipmap、layout你可以這樣Toast.makeText(context,pos+"",Toast.LENGTH_SHORT).show();在pos中加上+""這樣就會被當作String進行操作就沒有問題了
2017-03-07