hanks-zyh / animatecheckbox Goto Github PK
View Code? Open in Web Editor NEWA custom view in Android with a animation when CheckBox status changed
A custom view in Android with a animation when CheckBox status changed
I have a ListView with checkboxes which states I'm saving in ArrayList. After trying to recreate listview to edit this list, somehow first item get checked even if it wasn't checked. Data in list is correct, as I was checking it in all states, before and after editing. When I change your animate checkbox on default one everything work like a charm.
Below is the code snippet of my getView in BaseAdapter.
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
final PersonItemsCount item = personItemsCheckedList.get(position);
ViewHolder holder;
View view = convertView;
if (view == null) {
view = inflater.inflate(R.layout.add_price_dialog_row, null);
holder = new ViewHolder(view);
view.setTag(holder);
} else {
holder = (ViewHolder) view.getTag();
}
holder.chb.setTag(item);
holder.nameTv.setText(item.getPerson().getName());
holder.chb.setChecked(item.isChecked());
holder.chb.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
PersonItemsCount clickedItem = (PersonItemsCount) v.getTag();
boolean isChecked = !((AnimateCheckBox) v).isChecked();
clickedItem.setChecked(isChecked);
notifyDataSetChanged();
}
});
holder.portionNp.setValue(item.getItemsCount());
return view;
}
Attaching sample of checkbox behavior.
Also attaching sample of listview with default checkboxes, just to make sure that program logic is correct.
I want to add #00CA9D color as a background but it adds darker side of this color. I need only this color as a background and not the darker one.
when I use it in Listview,if the listview is over a Screen height and the view is already checked,when I back to top ,it would not refresh as it was checked..At last the item was not checked...
5.0一下不支持吗,我在4.4下面没办法编译通过
I need to change the size of uncheck check box size. How can i implement this?
I have tried your animateCheckBox but its animation does not stop. It continuously runs.
setChecked doesn't work visually, it sets value, but icon is not changed to checked. When i click it again, it first animate check, then instantly uncheck.
tried this way
View v = layoutInflater.inflate(R.layout.ingredient_in_basket, null); ... final AnimateCheckBox cb = ButterKnife.findById(v, R.id.cbInBasket); ... cb.setChecked(true); card.setOnClickListener(this); cb.setOnCheckedChangeListener(this);
and this way
int childcount = llIngredientsInBasket.getChildCount(); for (int i = 0; i < childcount; i++) { View v = llIngredientsInBasket.getChildAt(i); AnimateCheckBox cb = (AnimateCheckBox) v.findViewById(R.id.cbInBasket); cb.setChecked(true); }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.