Comments (4)
自己存下每个item的购买数量,然后onBindViewHolder时调用setTextNum哇
from elemeshoppingview.
嗯,这样是可以。不过还是个问题,由于初始默认每个item的购买数量为0,当调用setTextNum(0)时就会控件会显示展开状态,而且当切换其中一个item的状态,还是会影响其他的item,这怎么改啊
from elemeshoppingview.
无奈之举,把动画取消了,只保留一种状态,也就是显示加号减号数量
from elemeshoppingview.
You can use SparseIntArray to keep track of the purchase count. In the beginning, all will be zero. At onBindViewHolder, check for value of SparseIntArray at position and then use setTextNum if this value is greater than zero. This would help to keep functionalities of the buttons. Also don't forget to update your SparseIntArray at position with the value of purchase when the +/- button is pressed.
from elemeshoppingview.
Related Issues (11)
- 背景圆角 HOT 5
- 首页预览图挂了
- Changing Button Size
- Error on Installation HOT 1
- 在RecyclerView使用ShoppingClickListener不会拦截父控件的点击事件 HOT 2
- OnAddClick on OnShoppingClickListener not catching first click HOT 3
- viewholder 复用状态问题
- get Number (text) from ShoppingView in RecyclerView
- Showing Counter By Default and Not Text HOT 1
- How to Override DEFAULT_SHOPPING_TEXT in code
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elemeshoppingview.