Style And Theme In Android

In Android Style And theme is use to customize the application in appropriate way.

Using Style  we can can do changes in the control’s and also in the whole application.

just we have create the style in the style.xml  and we can use it anywhere in the application.

 

 

Style And Theme Example:

Step 1: Create a new project and give the appropriate name.

  • Select File -> New -> New Project. Fill the forms and click “Finish” button.

Step 2: After that we have to create the style in the style.xml file we can use <style></style> tag and in between we have to use <item></item> tag.

Step 3: To create the style we have to do some coding in the style .XML file which are as below.

step 4: Open res -> layout -> XML (or) activity_main.xml and add style attribute to use the style which we declare in the style.xml file and follow the  code which are given bellow.

Step 5: We have to do coding in java file but here we only check the style and them so we are going to take only control so we don’t need to code in java file.

Step 6: If you want to make changes for the whole application then you hve to create the style in style.xml  as we created above and after that we have to do changes in theme name which we can do in AndroidManifest.xml file. You can see the code the AndroidManifest file bellow.

Output:

Now run the app in Emulator and click on the button. You will see the changes in the application.

Style And Theme

Leave a Reply

Your email address will not be published. Required fields are marked *