Android Studio Change Default Android App Templates

Android Studio Change Default Android App Templates

Every time you create a new Android Studio Project with any activity selected, android studio creates your app project with some inbuild or default app templates. For example, below image shows window where we need to select the android activity. All below is some templates is used to start our android project.

At the time of writing this article we have following options for creating a new activity in our project.

  1. Basic Activity
  2. Bottom Navigation Activity
  3. Empty Activity
  4. Fullscreen Activity
  5. Google AdMob Ads Activity
  6. Google Maps Activity
  7. Login Activity
  8. Master /Detail Flow
  9. Navigation Drawer Activity
  10. Scrolling Activity
  11. Setting Activity
  12. Tabbed Activity

When you select any one of this and add it in your project then colors.xml and style.xml files are going to added in your app based on the selected activity. Below is the Colors.xml and style.xml for Empty Activity.


<?xml version="1.0" encoding="utf-8"?>
    <color name="colorPrimary">#3F51B5</color>
    <color name="colorPrimaryDark">#303F9F</color>
    <color name="colorAccent">#FF4081</color>



<pre class="brush:xml;">

    &lt;!-- Base application theme. --&gt;
    &lt;style name=&quot;AppTheme&quot; parent=&quot;Theme.AppCompat.Light.DarkActionBar&quot;&gt;
        &lt;!-- Customize your theme here. --&gt;
        &lt;item name=&quot;colorPrimary&quot;&gt;@color/colorPrimary&lt;/item&gt;
        &lt;item name=&quot;colorPrimaryDark&quot;&gt;@color/colorPrimaryDark&lt;/item&gt;
        &lt;item name=&quot;colorAccent&quot;&gt;@color/colorAccent&lt;/item&gt;




And this how our activity looks.

Every time when we create any activity for new project our activity looks same. But i want to change this.


Everyone have their own reason to do this. For me i want to change activity theme so for my every demo app it’s matches with website color combination. So how to change? Ok we are going to learn this now.

To achieve our scenario, we are going to modify two files in 

C:\Program Files\Android\Android Studio\plugins\android\lib\templates\gradle-projects\NewAndroidModule\root\res\values.

Above path is going to be change based on your installation directory and OS. Above path is for Windows and android studio is installed in C Drive.

..\Android Studio\plugins\android\lib\templates\gradle-projects\NewAndroidModule\root\res\values\..

In this folder we have following file

  • colors.xml
  • strings.xml.ftl
  • styles.xml.ftl

We are going to modify colors.xml below is the before after changes.



<p>Before Changes colors.xml file</p>

<pre class="brush:xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
	&lt;color name=&quot;colorPrimary&quot;&gt;#3F51B5&lt;/color&gt;
    &lt;color name=&quot;colorPrimaryDark&quot;&gt;#303F9F&lt;/color&gt;
    &lt;color name=&quot;colorAccent&quot;&gt;#FF4081&lt;/color&gt;



<p>After Change colors.xml</p>

<pre class="brush:xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
	&lt;color name=&quot;colorPrimary&quot;&gt;#3F51B5&lt;/color&gt;
    &lt;color name=&quot;colorPrimaryDark&quot;&gt;#303F9F&lt;/color&gt;
    &lt;color name=&quot;colorAccent&quot;&gt;#FF4081&lt;/color&gt; --&gt;
	&lt;!-- New Colors based on our requirement --&gt;
	&lt;color name=&quot;colorPrimary&quot;&gt;#2a2a2a&lt;/color&gt;
    &lt;color name=&quot;colorPrimaryDark&quot;&gt;#e3c800&lt;/color&gt;
    &lt;color name=&quot;colorAccent&quot;&gt;#81b71a&lt;/color&gt;


Now every time when we create a new Project our activity is now going to looks like as shown in below image.

This is one way, we can do more. But for this article it is enough. You can learn more about by creating your own templates in our next article.

You can watch all the above steps in the below video.

Leave A Comment

Please login to post your valuable comments.

Join the newsletter

Get the latest vLemonn news first