Rounded corner BTN implementation
- Using Shape
- Set the GradientDrawable implementation, which is essentially a Shape
- Refer to www.jianshu.com/p/ab42f2198…
Implement circular BTN
- Set GradientDrawable, and set shape to it
BTN press down border effect
- Set the selector directly, if you set the effect on a button you should use AppCompatButton otherwise there is no effect
- Click to switch the background of an outer layout with Selector
- Add background dynamically via the GradientDrawable setStroke method
- Set a GLAG and then dynamically draw a border in the onDraw method
- Put a Framelayout in the BTN XML, set a background box, image or shape on the Framelayout, and adjust it to show and hide dynamically
All of the above methods draw the inner border of a view
State switch of item in RecycleView
- The public method that sets the custom item is called in the onBindViewHolder method
- Dynamically toggle by setting the selector of the item and checking the select, pressed, and other properties of the item
- Perform a UI switch by setting the flag mCurrentSelectedIndex and then onBindViewHolder to determine if position is equal to mCurrentSelectedIndex