1. 程式人生 > >自定義AndroidStudio中的預設Header資訊

自定義AndroidStudio中的預設Header資訊

When you create a new class file in Android Studio, it will automatically add a header to it. By default the header contains the user/author name and file created date. Something like ‘Created by user on date‘.

Android-Studio-File-Header-Text

This header can be customized to change the name of the author and also to include other information.

Here’s how,

Bring up the Settings dialog, (File > Settings). Search for ‘File and Code Templates‘  or alternatively navigate toEditor > File and Code Templates. Click on the ‘Includes‘ tab and then select ‘File Header‘ from the left pane. The content of the ‘File Header‘ template will be displayed on the right pane.

Android-Studio-File-and-Code-Templates-Settings

Notice how the default template contains two variables ${USER} and ${DATE}. While creating a new file Android Studio assigns the values to these variables and adds the output text in the file header.

The description pane below contains details of other available predefined variables that you can use in the template, for example, ${PACKAGE_NAME}

 will insert name of the package or ${PROJECT_NAME} will insert the name of the project etc. You can include any of these variables in the template and Android Studio will use them while generating the file header. What’s more, you can define your own variables or assign a new value to a predefined variable like $USER. For example, let’s change the user (author) name to ‘John Smith’ ,

#set ($USER = "John Smith")

Let’s also define a few new variables,

#set ($ORGANIZATION_NAME = "Super Awesome Company")
#set ($CONTACT_EMAIL= "[email protected]")
#set ($PROJECT_URL= "http://urltomyawesomeproject.com")

Once the variables are defined and assigned values, you will need to include them in the template to actually use them. Here’s the completed template for reference,

android-studio-file-header-template

Now, lets create a new class file to test our new file header template. Here’s our custom file header in all its glory.

android-studio-custom-file-header

相關推薦

定義AndroidStudio預設Header資訊

When you create a new class file in Android Studio, it will automatically add a header to it. By default the header contains the user/au

Spring Boot下如何定義Repository的DAO方法

hibernate reat 軟件測試 bst pass update pop 後綴 mark 環境配置介紹 jdk 1.8, spring Boot 1.5.3.RELEASE, MySQL, Spring Data, JPA 問題描述 Spring Data提供了一套簡

去除定義Toolbar左邊距

分享 roi mar tap ring att blog img pac 問題 自定義Toolbar之後,發現左側不能完全填充,總是留一點空白,如下圖: 原因 查看Wiget.AppCompat.Toolbar的parent(Toolbar默認的style),如下: &l

javaScript定義sort的比較函數,用於比較字符串長度,數值大小

var cti lin family 字符串長度 tr1 個數 new fun var arr = [‘aa‘, 23, 1.2, ‘bb‘, ‘cc‘]; var len = arr.length; // for (var i = 0; i < len; i++)

背水一戰 Windows 10 (64) - 控件(WebView): 加載指定 HttpMethod 的請求, 定義請求的 http header, app 與 js 的交互

如何 pan runt logs threading dto void msg def [源碼下載] 背水一戰 Windows 10 (64) - 控件(WebView): 加載指定 HttpMethod 的請求, 自定義請求的 http header, app 與 js

如何在SAP Cloud for Customer定義BO創建訪問控制

global ssp 我會 TP BE lis 訪問權限 author ext 文章作者: Yi 已獲得Yi的轉載許可。 訪問控制方式和使用註意事項 1. C4C中的訪問控制有兩種方式 RelevantForAccessControl AccessControlConte

Angularjs進階筆記(2)-定義指令的數據綁定

粘貼 文章 發送 制作 取值 不同的 過多 簡單 也會 Angularjs進階筆記(2)-自定義指令中的數據綁定 有關自定義指令的scope參數,網上很多文章都在講這3種綁定方式實現的效果是什麽,但幾乎沒有人講到底怎麽使用,本篇希望聊聊到底怎麽用這個話題。 一. 自定義

Excel怎麽樣讓負數自動顯示紅色在定義格式如何添加條件判斷呢【已解決】

來源 tex vpd 問題 ref 負數 添加 博客 如何 在通常的情況下,負數會用紅色顯示,而這裏的負數就是一個簡單的條件判斷。那麽怎麽才能讓excel遇到負數就變成紅色,效果如圖常見問題出現特定的數據時怎麽變顏色? 比如數值為負數就自動變成紅色? 【解決方法,教程視頻資

資料結構與演算法----定義函式與資料成員

近期在梳理知識,做一個小結,希望自己能多多使用 在標頭檔案中: enum sign {plus, minus}; class Accruency { public: Accruency(sign s = plus, unsigned long d = 0, unsigned in

iOS定義協議的byte使用

自定義的簡單協議一般包括訊息頭部,訊息碼,訊息體,校驗碼和尾部,一個專案裡面用到的頭部和尾部一般都是固定的,訊息碼用來標識是哪一條訊息,校驗碼用來校驗資料完整性 在一些需要相容多端的開發的時候,可能會遇到使用自定義協議,比如與硬體通訊或者使用socket的時候,接受的資料是按約定

spring定義@AutoWired標識的元素注入為null

最近在做專案的時候,發現程式執行的時候有一個nullpointer exception,一臉懵逼因為感覺程式沒什麼邏輯。後來發現是因為new出來的component不會自動注入它的元素。 現象:@Component修飾的自定義普通類中@Autowired屬性為null 原因:如果是通過new例項化的物件,

025.定義View應用貝塞爾曲線

之前一直看QQ的未讀訊息拖拽消失設計得很好,我一直覺得那個設計很好,他們的UI是真心強,於是,我也一直想寫個一樣的玩意來玩玩。最近剛好在複習View相關的知識,就拿這個來練手,下面先來看實現的效果圖: 這是我希望實現的效果,這個效果的實現在第二個圖能看出一點端倪。這裡面的曲線繪製,

dede織夢繫統後臺的文章或定義模型的資料庫內容到匯出excel檔案,解決亂碼。

dede織夢繫統後臺的文章或自定義模型中的資料庫內容到匯出excel檔案,解決亂碼。好品牌小編下面分享的開發過程。   1、在後臺目錄建立一個php檔案toexcel.php,在最上面加入程式碼: require_once(dirname(__FILE__).'/confi

C# winform 定義函式找不到Form的控制元件和定義的全域性變數

今天碰到一個比較狗血的問題,想了很多辦法,最後發現,原來如此的坑。 在新建一個form頁面後,我們在程式碼頁面寫程式碼,往往會寫自定義的方法,一般情況下,在自定義的方法中是可以找到form頁面中的控制元件和自定義的全域性變數, 但是如果我們在自定義的方法前面加了static,那麼坑就出來啦,從此這個方法好

定義View的大轉盤和拖動的小球

public class ZPView2 extends View implements View.OnClickListener { //文字內容 private String[] contents=new String[]{“美 食”, “購 物”, “商 場”, “豐 滿”, “性 感

獲取指定包下所有定義註解並提取註解資訊

Reflections 通過掃描 classpath,索引元資料,允許在執行時查詢這些元資料,也可以儲存收集專案中多個模組的元資料資訊。 使用Reflections快速掃描指定包下自定義的Controller和RequestMapping兩個註解,先去掃描加了@Cont

淺談定義View一些常用的回撥方法

1. 構造方法 1.public View(Context context) 2.public View(Context context, @Nullable AttributeSet attrs) 3.public View(Context context, @Nulla

MapReduce 之 ---定義全域性計數器,將資訊輸出到控制檯

package jishuqi; import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.ha

C#定義操作主窗體控制元件,通過委託實現

主窗體中包含一個標籤label1和一個按鈕button1 程式碼如下: public void ChangeLabel(string text) { label1.Text = text; } private void button1_Click(o

gridControl定義資料

1、要實現自定義資料列設定UnboundType為string2、要實現自定義資料列設定Name和FileName一樣,不要和繫結的資料來源列名一樣3、為gridVIew加gv_CustomUnboundColumnData事件4、實現gv_CustomUnboundCol