Notes Color Changing app

Photo by Andrew Neel on Unsplash

Notes Color Changing app

Color changing on click APP

  • setListener -> Main function/method ,clickable view-> variable to store list of views

  • clickableView: List<View> = listOf(box_one_text, box_two_text, box_three_text, box_four_text, box_five_text)

  • it initializes a list of views (clickableView) that you want to add click listeners to.

  • It iterates through each item in clickableView and sets a click listener to each item, calling the addingColor method when clicked.

  • setListeners initializes a list of views (clickableView) that you want to add click listeners to.

  • It iterates through each item in clickableView and sets a click listener to each item, calling the addingColor method when clicked.

  • use a when statement to determine which view was clicked and sets its background color accordingly.

  • The view IDs used in addingColor method (R.id.box_one_text, R.id.box_two_text, etc.) should correspond to the IDs of the views in your XML layout (activity_main.xml).

  • ADDING OF COLOR EXAMPLE CODE
    R.id.box_one_text -> view.setBackgroundColor(Color.DKGRAY)

  • While adding Baseline , Consider A,B,C . A is attached to B.

  • B cannot be attached to A.

  • B cannot be attached to C.

  • C can be attached to B.

Used Horizontal Chaining b/w buttons .