In this post we will show you the easiest and quickest way to create style for your layout elements. This android quick tip could be very useful if you are using multiple elements of the same type that have common characteristics.

The first step in doing this is: go to your layout element and right click on it. Select Refactor/Extract/Style, just like on the image shown below:

After this you need to name the style and you get to choose which of the properties would you like to include in the style that you are creating. Select those that you now that will be the same in multiple elements for best use of the style.

When you click on the ok button, Android Studio will present you with the option to use style where possible, and you get to choose to use it on the current layout file or on the whole project:

And that is all, you have created your style, happy coding!

Spread the love

Leave a Reply

Your email address will not be published.