Automatic style and layout generator based on existing view

Just a short, yet useful tip. In Android Studio, right clicking on a view in your layout’s XML file and then Refactor > Extract > Style will turn this:

<EditText
        android:id="@+id/description"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/description"
        android:inputType="text"
        android:maxLength="256"
        android:lines="4"/>

into this:

<EditText
        android:id="@+id/description"
        android:hint="@string/description"
        style="@style/EditText"/>

and will create a new entry in your default styles.xml file:

<style name="EditText">
    <item name="android:layout_width">match_parent</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:inputType">text</item>
    <item name="android:maxLength">256</item>
    <item name="android:lines">4</item>
</style>

Similarly, you can extract a view into a separate layout file.