NestedScrollView+RecyclerView 滑動卡頓簡單解決方案
今天遇到一個問題,就是那個使用NestedScrollView+RecyclerView會卡頓,這樣滑動起來會卡頓,給使用者帶來了很不好的體驗,也是想著去解決一下。於是我上了百度,哈哈,別我找到了解決方案,我記錄一下,也供大家參考一下。
在給RecyclerView設定layoutManager 的時候設定幾個引數,我附上原始碼的解釋,引數的意思我也大概的翻譯一下,意思差不多,方便大家理解
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
/**
* When smooth scrollbar is enabled, the position and size of the scrollbar thumb is computed
* based on the number of visible pixels in the visible items. This however assumes that all
* list items have similar or equal widths or heights (depending on list orientation).
* If you use a list in which items have different dimensions, the scrollbar will change
* appearance as the user scrolls through the list. To avoid this issue, you need to disable
* this property.
*/
//啟用平滑滾動條
layoutManager.setSmoothScrollbarEnabled(true);
/**Defines whether the layout should be measured by the RecyclerView or the LayoutManager
* wants to handle the layout measurements itself.
*/
//自動測量
layoutManager.setAutoMeasureEnabled(true);
recyclerView.setLayoutManager(layoutManager);
//@param hasFixedSize true if adapter changes cannot affect the size of the RecyclerView.
recyclerView.setHasFixedSize(true);
//巢狀設定為不可滑動
recycerView.setNestedScrollingEnabled(false);
ok,到此就結束了
相關文章
- vue 介面在蘋果手機上滑動點選事件等卡頓解決方案Vue蘋果事件
- 不要在 XML 設定,解決 NestedScrollView 巢狀 RecyclerView 滑動卡頓XMLView巢狀
- 如何解決快應用頁面滑動卡頓問題
- 優化動畫卡頓:卡頓原因分析及優化方案優化動畫
- 移動APP卡頓問題解決實踐APP
- div拖動遇到iframe卡頓的問題解決
- win10執行老遊戲卡頓怎麼解決 win10執行老遊戲頻繁卡頓解決方案Win10遊戲
- (轉)解決XMind執行卡頓
- 蘋果容器超出內容overflow滑動卡頓問題蘋果
- 使用NVRAM的簡單解決方案VR
- 直播系統中影片出現卡頓的原因及解決方案
- win10系統卡頓怎麼解決 win10系統卡頓的解決方法Win10
- win10卡頓嚴重怎麼解決 win10卡頓嚴重的解決方法Win10
- CollectionView 單個選項卡的滑動View
- SSH 連線卡頓解決辦法
- 一種巢狀滑動衝突的解決方案巢狀
- 解決方案 | IrfanView如何滑動滾輪影像縮放?View
- 簡單的mock-server 解決方案MockServer
- 移動端swiper嵌iframe無法滑動的解決方案
- -webkit-overflow-scrolling解決移動端iOS滾動卡頓現象WebKitiOS
- 簡單的瞭解跨域以及解決方案跨域
- 一種非巢狀滑動衝突的解決方案巢狀
- vant小程式SwipeCell 完美解決滑動單元格右滑無樣式
- 關於iScroll外掛在某一些手機上滑動卡頓或者不滑動的處理
- runloop解決Cell上主執行緒卡頓OOP執行緒
- 記解決 Postman 卡頓,佔 CUP,卡死問題Postman
- 電腦滑鼠卡頓不流暢是什麼原因 電腦滑鼠卡頓怎麼解決
- 用ListView簡單實現滑動列表View
- 調皮的記憶體抖動?前生今世及App解決卡頓慢記憶體APP
- 解決伺服器卡頓的三大方法伺服器
- win10卡頓嚴重怎麼回事 完美解決win10系統卡頓的方法Win10
- 聊天平臺原始碼,簡單使用 禁止滑動和設定滑動方向原始碼
- 波卡生態現行的流動性解決方案
- 滑動動效解決方案(CSS antd-mobile better-scroll react-transition-group)CSSReact
- UIPikerView 省市區三聯滑動,解決滑動崩潰問題UIView
- win10下photoshop使用卡頓怎麼辦_win10下photoshop使用卡頓的解決方法Win10
- win10 cad卡頓黑屏解決方法 win10上執行cad卡頓黑屏修復方法Win10
- win10平板模式卡頓怎麼修復_win10平板模式卡頓嚴重完美解決Win10模式
- 阿里雲滑塊驗證失敗解決方案阿里