之前這樣搞過,每次studio升級(jí)都會(huì)刪掉我們自己寫的模板娄昆,現(xiàn)在干脆放棄了這種方式
每個(gè)Activity模板佩微,對(duì)應(yīng)一個(gè)文件夾,對(duì)應(yīng)我們創(chuàng)造Activity時(shí)萌焰,New Activity哺眯,
除了內(nèi)置的幾個(gè)模板,我們可以自己開發(fā)杆怕,當(dāng)然github上也有部分開源的模板族购,只需要下載別人提供的模板文件,copy至as安裝目錄下:/plugins/android/lib/templates/activities
然后重啟Android Studio即可陵珍。
可以參考的插件如下:
https://github.com/kanytu/Android-studio-material-template
A template for Android Studio to create applications with material design and Navigation Drawer.包含:MaterialNavigationDrawerActivity
https://github.com/MontazzeStudio/android-studio-template
包含DrawerWithTabsActivity和RecyclerRefreshActivity
https://github.com/gabrielemariotti/AndroidStudioTemplate
包含SwipeRefreshLayout,還有一些常用的模板违施。
除了Activity模板互纯,還有些其他的模板,例如下面這個(gè)模板就很有意思:
https://github.com/intrications/material-design-icons-adt-template
用于創(chuàng)建Material Design Icon磕蒲,可以非常方便的創(chuàng)建Icon留潦,再也不需要自己去找下載各種尺寸了。
New-->Other-->Material Deaign Lcons,然后可以選擇創(chuàng)建需要的Icon
當(dāng)然上述這些開源項(xiàng)目理論上只是用于參考辣往,不過講道理我們應(yīng)該自己去學(xué)習(xí)如何編寫這樣的模板兔院,針對(duì)我們平時(shí)的需求去編寫一些模板,提升開發(fā)效率站削。
我也給大家找了些模板開發(fā)的相關(guān)鏈接坊萝,大家可以參考下。
http://www.reibang.com/p/81d03519dd33
https://www.zhihu.com/question/46979171
http://www.i-programmer.info/professional-programmer/resources-and-tools/6845-android-adt-template-format-document.html
https://developer.android.com/studio/projects/templates.html
http://robusttechhouse.com/tutorial-how-to-create-custom-android-code-templates/
https://github.com/WanAndroid/AndroidStudioTemplates