Comments (6)
You must remember checked state and set it again when recycler is drawing your layout :)
from shinebutton.
@linean please can you help me with that, i have no idea how to work that out.
from shinebutton.
The select state is control by data. You should add flags or modify data to let view remember you state when you use listView or recyclerView. So you can try to control it by using setChecked(bool) in callBack onBindViewHolder().
Such as:
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
holder.shineButton.setChecked(data.get(position).isChecked());
}
from shinebutton.
its not working, i set a flag already, this what am doing below
`holder.ivLike.setTag(holder);
holder.ivLike.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
PostsViewHolder viewHolder =(PostsViewHolder) v.getTag();
if (!isLike) {
like(postsData.getNews_id());
viewHolder.tvNewsCountLike.setText("" + (Integer.parseInt(holder.tvNewsCountLike.getText().toString()) + 1));
viewHolder.ivLike.setChecked(true);
isLike = true;
} else {
unlike(postsData.getNews_id());
viewHolder.tvNewsCountLike.setText("" + (Integer.parseInt(holder.tvNewsCountLike.getText().toString()) - 1));
viewHolder.ivLike.setChecked(false);
isLike = false;
}
}
});`
from shinebutton.
@moderateepheezy
Add boolean property "isLike" in PostsData.
Set this property when you click.
Add control code as follow.
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
holder.shineButton.setChecked(postsDataList.get(position).isChecked());
}
from shinebutton.
This is the basic knowledge of listView
from shinebutton.
Related Issues (20)
- Need help
- Not clickable HOT 2
- It is not working with SVG? HOT 1
- can i rotate like button to dislike button?
- Animation doesn't work when FLAG_LAYOUT_NO_LIMITS is enabled
- Animation dos not work while keyboard is open. HOT 1
- Shine Animation location is different. HOT 2
- status
- Button not showing in API 26 and above
- when it used on Android P,the ring was out of position HOT 11
- Draw bug? HOT 1
- i want to use my custom picture in raw folder but it doesnt work HOT 1
- 无法更换点击后的图片 HOT 3
- How to set this button to clicked?
- Two Different SRC
- ShineView didn't remove after shine finished. HOT 1
- not removing shining effect after click to shine
- update dependecies maven central
- Please update the dependencies HOT 1
- Update dependecies maven central HOT 2
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 shinebutton.