So, I want to create Custom Views, set Linear Layouts equal to them and, I want to make them clickable. So, when I click that Linear Layout View, I want it to have the click animation, the same way List Item has(it goes orange and you have that feeling that you clicked it). How to do this? Thanks!
Asked
Active
Viewed 1,530 times
0
-
Selectors that is the word you should be googling for ;) this is not considered an animation but a state. – Tobrun Feb 14 '14 at 13:19
-
e.g. http://stackoverflow.com/questions/14023886/android-button-selector – Tobrun Feb 14 '14 at 13:19
1 Answers
0
Very, very late.
Anyone who finds this thread, use this.
findViewById(R.id.next_btn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Define your animator here
Animator scale = ObjectAnimator.ofPropertyValuesHolder(v,
PropertyValuesHolder.ofFloat(View.SCALE_X, 1, 1.5f, 1),
PropertyValuesHolder.ofFloat(View.SCALE_Y, 1, 1.5f, 1)
);
scale.setDuration(1000);
scale.start();
}
});

hcl2000
- 16
- 4
-
1Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 16 '23 at 01:19