For example, sometimes it seems very laborious and troublesome to write hundreds of lines in a layout. At this time, it is necessary to extract the control style. Android Studio provides a way to extract the style style. It may be hidden too deep, and few people use
The cursor is placed in the control: Right-click –>Refactor –> Extract –>Style…
After selecting, a dialog box pops up:
If you use it a lot, you can also set a shortcut key for it:
Open the Android Studio settings page, search for extract in the Keymap, and that's it for Style, then right-click on Style to add a shortcut key for it
A pop-up window will pop up, just press the shortcut key you want to set and it will be OK, and then confirm
Then just use the shortcut keys and have fun
Supplementary knowledge: Android Studio Button beautification
Change the corner, fill color and border color of the button Button control.
step:
Create a new btn_all_shape.xml in res>drawable:
android:bottomLeftRadius="15dp"
android:bottomRightRadius="15dp"
android:topLeftRadius="15dp"
android:topRightRadius="15dp" />
Add this sentence to the xml of the key you want to change:
android:background="@drawable/btn_all_shape"
The above Android Studio automatic extraction control style style tutorial is all the content shared by the editor. I hope it can give you a reference, and I hope you can support the free resource network.