How can I use code template in android when creati

2020-06-20 12:14发布

I have used android code templates in eclipse such as blank activity,login activity etc. I want to use these templates while creating project from command line. How can I do this?

1条回答
对你真心纯属浪费
2楼-- · 2020-06-20 13:12

You can write and render these templates (or any other template you want to create) using Ruby's ERB gem.

From http://www.ictforu.com/index.php/Ruby/erb-ruby.html:

ERB is an abbreviation for Embedded Ruby

ERB is a feature of Ruby that enables user to dynamically generate any kind of text from templates. The templates combine plain text with Ruby code for variable substitution and flow control, which makes them easy to write and maintain.

ERB is commonly used in Rails platform to generate the webpages, It is also used in generating XML files, Source code, etc.

Although it's quite common in Ruby on Rails you can use it wherever you want ;-)

I suggest you to check:

查看更多
登录 后发表回答