0

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!

Luka Bulatovic
  • 357
  • 5
  • 19

1 Answers1

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
  • 1
    Your 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