Android Studio小技巧

Android Studio Tips of the Day里面一共有八十几个。大家可以去查看完整的。而且是持续更新状态中。很有用(记得安全上网,翻墙哦。)

1、tools:attribute

如果你需要查看写的TextView在有文字时候的预览情况。那么这个就是为你准备的。使用'tools:something="value"'这个值会显示在预览时候,但是在软件真正运行的时候不会出现这个内容。
只需要二步就可以:

  • 在根布局中添加xmlns:tools="http://schemas.android.com/tools"

  • 在TextView中使用'tools:something="value"'属性

(这个太有用了!!!我以前每次写布局预览效果都用android:text = "XXX",然后程序弄完还得去删。太傻了!!!)

2、Extract Resource

比如你在布局文件或者代码文件中直接写了某个String字符串或者某个dimen数值,而不是引用资源文件,那难道还要我再去打开相应的String.xml或者dimen.xml文件去添加,然后这边的布局文件或者代码文件中再去修改使用引用?答案当然是NO。
* Mac:选中那个值,然后option+enter键选择Extract String/Dimension Resource 。
* Win: alt+enter键选择Extract String/Dimension Resource 。

3、Toggle between text/design mode

Design查看和Text编辑之间切换
* mac用Control + Shift +左/右
* Windows和Linux上用ALT + SHIFT +左/右

4、CamelHumps

在"Editor->General->Smart Keys"中启动"CamelHumps"功能选项,就可以在连在一起的几个大写为首的单词间快速切换。
* Mac上是option+左右键。
* win上为 "alt" or "ctrl" 键。(这里会有个bug,开启后,比如你的变量名是几个单词,比如是isSuccess,这时候你双击想选中这个变量就发现不能全部选中,就变成选中Success了。)

5、Close Others

当Android Studio开了很多文件,想要留下当前文件,然后关闭其他文件,通常做法是右键,然后选择Close Others。实际上只需要
* Mac:按住option,然后鼠标点击要留下来的文件的关闭按钮,然后其他的就都关闭了
* Win:按住alt.

6、The Navigation Bar

导航栏是在IDE顶部的“面包屑”。
这表明你的路径添加到当前文件,但你也可以用它来导航和/或采取对文件和文件夹的操作。

  • 您可以导航到父母的子文件夹或找到兄弟类
  • 您可以轻松地创建使用代码生成快捷方式(CMD + N / ALT +插入)新文件
  • 事实上,你可以在项目视图通过右键点击做任何事情
  • 你可以隐藏这个导航栏。通过快捷键来显示。可以让Android Studio的屏幕显示内容可以更多。

7、Open Source in New Window

你能让当前打开的文件,以另起一个窗口来进行显示。
* Mac:shift +F4(有些人F4可能是系统快捷键,那就多加一个fn)
* Win:shift+F4

8、Override Methods

我们可能想重载某个父类的方法,但是一时间忘记了这个方法的名字,可以快捷键调出所有可重载的方法,进行选择。
* Mac:control + o
* Win:ctrl + o

9、Edit Regex

描述:使用Java编写正则表达式是一件很困难的事,主要原因是:

  • 你必须得避开反斜杠;
  • 说实话,正则很难;
  • 看第二条。
    IDE能帮我们干点啥呢?当然是一个舒服的界面来编写和测试正则啦~ - 快捷键:Alt + Enter → check regexp

10、The Switcher

打开的文件太多。怎么快速切换文件?
* Mac : control + tab
* win: ctrl + tab

评论

  • MakritskayaGergo回复

    only now cheepest viagra

    <a href=http://viagraoail.com/>viagra online</a>

    <a href="http://viagraoail.com/">buy viagra online</a>

    spain female viagra

  • a diabetes association回复

    This is a very good tip especially to those new to the blogosphere.
    Short but very precise information… Thanks for sharing this one.
    A must read post!

  • Interior Home Design回复

    Normally I do not read article on blogs, however I would like to say that this write-up very pressured me to try and do so! Your writing style has been amazed me. Thanks, quite nice post.

  • arts and culture回复

    Hi there, I found your blog by the use of Google at the same time as searching for a comparable matter, your web site came up, it seems good. I have bookmarked it in my google bookmarks.

  • Carpeting回复

    Thank you for the sensible critique. Me & my neighbor were just preparing to do a little research about this. We got a grab a book from our area library but I think I learned more clear from this post. I am very glad to see such magnificent information being shared freely out there.

  • VladilenGergo回复

    generic viagra uk buy

    <a href=http://viagraomz.com/>generic viagra online</a>

    <a href="http://viagraomz.com/">generic viagra online</a>

    viagra medical advice

  • acne treatment gel origins回复

    I love your blog.. very nice colors & theme.
    Did you create this website yourself or did you hire someone to do it for you?
    Plz respond as I'm looking to construct my own blog and would like to know where u
    got this from. thanks

  • ทะเบียนสวย回复

    Do you mind if I quote a couple of your articles as long as I provide credit and sources back to
    your site? My blog is in the exact same niche as yours and my users would definitely benefit
    from a lot of the information you present here.
    Please let me know if this ok with you. Regards!

  • loja de bebe回复

    usually posts some very exciting stuff like this. If you are new to this site

  • weed delivery Big Lakes County回复

    This is really interesting, You are a very skilled blogger. I ave joined your rss feed and look forward to seeking more of your fantastic post. Also, I have shared your site in my social networks!

  • #1 acne home remedy回复

    Excellent way of describing, and pleasant piece of writing to take facts about my presentation topic, which i am going to present in institution of higher education.

  • CheplanovaGergo回复

    viagra shipped within canada

    http://viagralms.com/ - viagra cheap

    <a href="http://viagralms.com/">buy generic viagra</a>

    36 hour viagra dosage

  • CheplanovaGergo回复

    viagra cialis contraffatt

    http://viagralms.com/ - viagra cheap

    <a href="http://viagralms.com/">buy generic viagra</a>

    viagra makes you last longer

  • CheplanovaGergo回复

    pfizer viagra online bestellen

    http://viagralms.com/ - cheap viagra

    <a href="http://viagralms.com/">generic viagra online</a>

    compra de viagra super

  • Umanizzare presidios回复

    What i don't realize is in truth how you are not actually a lot more well-liked than you may be now. You are so intelligent. You recognize therefore considerably in the case of this subject, produced me in my opinion imagine it from a lot of numerous angles. Its like men and women are not involved until it is something to accomplish with Lady gaga! Your individual stuffs outstanding. All the time care for it up!|

  • Juegos Friv回复

    Looking forward to reading more. Great article.Really thank you! Cool.

  • mobile games download free for samsung回复

    Ed Sheeran's had a reasonably good 12 months:
    his music, Shape of You,” was one of many hottest tracks of the early
    a part of 2017 and his third studio album, ÷, was a No.1 hit
    in both the U.S. and U.K. A cameo on Recreation of Thrones may improve his fairly good
    year to a fairly nice year.

  • for more info回复

    There is visibly a bunch to realize about this. I suppose you made some good points in features also.

  • for details回复

    Just Browsing While I was browsing yesterday I noticed a great post about

  • สมัคร gclub回复

    Wonderful ideas you have here.. Take pleasure in the blog you available.. Truly appreciate the entry you made available.. Enjoying the blog post.. thank you

  • VladilenGergo回复

    viagra autr

    <a href=http://viagraomz.com/>buy viagra online</a>

    <a href="http://viagraomz.com/">generic viagra online</a>

    viagra cialis experiencias

  • แว่นตา回复

    Great weblog right here! Also your website rather a lot up very fast!
    What web host are you the use of? Can I get your affiliate hyperlink on your host?
    I wish my website loaded up as quickly as yours lol

  • Public School回复

    I think other web-site proprietors should take this web site as an model, very clean and magnificent user friendly style and design, let alone the content. You are an expert in this topic!

  • rent a car回复

    We are a group of volunteers and starting a new scheme in our community. Your website offered us with valuable information to work on. You have done a formidable job and our whole community will be grateful to you.

  • Legal Aid Society回复

    As a Newbie, I am constantly searching online for articles that can benefit me. Thank you

  • jordan retro回复

    Spot on with this write-up, I actually suppose this website wants much more consideration. I抣l in all probability be once more to read way more, thanks for that info.

  • more here回复

    Muchos Gracias for your blog article.Thanks Again. Really Cool.

  • a cancer woman回复

    I absolutely love your blog.. Great colors & theme. Did you make this web site yourself?
    Please reply back as I'm looking to create my very own blog and would love to learn where you got
    this from or exactly what the theme is called. Appreciate it!

  • Lawyer回复

    Hello There. I found your blog using msn. This is a really well written article. I will make sure to bookmark it and come back to read more of your useful information. Thanks for the post. I’ll definitely return.

  • travel & leisure回复

    Hey very cool site!! Guy .. Excellent .. Wonderful .. I will bookmark your site and take the feeds additionally¡KI'm happy to find a lot of useful information here in the post, we'd like develop more techniques on this regard, thank you for sharing. . . . . .

  • Adult Education回复

    Undeniably believe that which you stated. Your favorite justification seemed to be on the web the simplest thing to be aware of. I say to you, I certainly get annoyed while people consider worries that they plainly don't know about. You managed to hit the nail upon the top as well as defined out the whole thing without having side effect , people could take a signal. Will likely be back to get more. Thanks