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

评论

  • live sex回复

    That is a really good tip particularly to those new to the blogosphere. Brief but very accurate information Appreciate your sharing this one. A must read article!

  • Health and Fitness回复

    Nice read, I just passed this onto a colleague who was doing some research on that. And he actually bought me lunch because I found it for him smile Thus let me rephrase that: Thank you for lunch! "Procrastination is the thief of time." by Edward Young.

  • Education回复

    Wow! This could be one particular of the most beneficial blogs We have ever arrive across on this subject. Actually Great. I'm also an expert in this topic so I can understand your hard work.

  • Health and Fitness回复

    Nice read, I just passed this onto a friend who was doing some research on that. And he actually bought me lunch since I found it for him smile Therefore let me rephrase that: Thank you for lunch! "High living and high thinking are poles apart." by B. J. Gupta.

  • Autos回复

    I was looking through some of your articles on this website and I think this web site is rattling instructive! Keep putting up.

  • Health and Fitness回复

    Whats up very nice blog!! Guy .. Beautiful .. Amazing .. I'll bookmark your website and take the feeds also…I am glad to find a lot of useful information here within the post, we'd like develop extra strategies on this regard, thanks for sharing.

  • Instagram slideshow回复

    Hi there would you mind letting me know which hosting company you're working with? I've loaded your blog in 3 completely different web browsers and I must say this blog loads a lot quicker then most. Can you recommend a good hosting provider at a fair price? Thanks a lot, I appreciate it!|

  • Health and Fitness回复

    I have been absent for a while, but now I remember why I used to love this web site. Thanks, I will try and check back more frequently. How frequently you update your website?

  • Health and Fitness回复

    Thanks for helping out, excellent info. "I have witnessed the softening of the hardest of hearts by a simple smile." by Goldie Hawn.

  • Autos回复

    you're in point of fact a just right webmaster. The web site loading pace is incredible. It sort of feels that you are doing any distinctive trick. Furthermore, The contents are masterpiece. you've done a excellent job on this matter!

  • Health and Fitness回复

    I think this is among the most vital information for me. And i'm glad reading your article. But want to remark on some general things, The web site style is perfect, the articles is really nice : D. Good job, cheers

  • click here回复

    Sometimes your blog is loading slowly, better find a better host.:-;.:

  • Health and Fitness回复

    Its wonderful as your other posts : D, regards for putting up. "Reason is the substance of the universe. The design of the world is absolutely rational." by Georg Wilhelm Friedrich Hegel.

  • Sports Jersey回复

    I've been browsing online more than 3 hours today, yet I never found any interesting article like yours. It is pretty worth enough for me. Personally, if all webmasters and bloggers made good content as you did, the web will be much more useful than ever before.

  • Health and Fitness回复

    Excellent read, I just passed this onto a friend who was doing a little research on that. And he just bought me lunch as I found it for him smile Therefore let me rephrase that: Thank you for lunch!

  • visit website回复

    You have mentioned very interesting points! ps decent web site.

  • Education回复

    Some genuinely nice and utilitarian info on this website, too I think the layout has got fantastic features.

  • seeking alpha回复

    I believe what you said made a bunch of sense. However, what about this? suppose you added a little content? I am not suggesting your information isn't solid, but what if you added a post title to possibly get folk's attention? I mean BLOG_TITLE is a little boring. You ought to peek at Yahoo's home page and watch how they create post headlines to grab people to open the links. You might add a related video or a pic or two to grab people interested about what you've got to say. Just my opinion, it might bring your posts a little livelier.|

  • Autos回复

    Hello, i think that i saw you visited my website so i came to “return the favor”.I am trying to find things to enhance my site!I suppose its ok to use some of your ideas!!

  • Exercise Music回复

    Incredible! This blog looks exactly like my old one! It as on a entirely different topic but it has pretty much the same page layout and design. Excellent choice of colors!

  • Health and Fitness回复

    Absolutely written articles, appreciate it for information. "The earth was made round so we would not see too far down the road." by Karen Blixen.

  • Health and Fitness回复

    I have been exploring for a little for any high-quality articles or weblog posts in this kind of house . Exploring in Yahoo I finally stumbled upon this web site. Studying this information So i¡¦m satisfied to convey that I have a very just right uncanny feeling I found out just what I needed. I such a lot surely will make certain to don¡¦t forget this site and provides it a look regularly.

  • Health and Fitness回复

    You can definitely see your enthusiasm within the work you write. The arena hopes for even more passionate writers like you who aren't afraid to mention how they believe. Always follow your heart.

  • Health and Fitness回复

    Enjoyed looking at this, very good stuff, thankyou . "Hereafter, in a better world than this, I shall desire more love and knowledge of you." by William Shakespeare.

  • Travel Info回复

    Hiya, I'm really glad I've found this information. Nowadays bloggers publish only about gossips and internet and this is actually frustrating. A good web site with exciting content, that's what I need. Thanks for keeping this website, I'll be visiting it. Do you do newsletters? Can't find it.

  • Health and Fitness回复

    My brother suggested I might like this website. He was totally right. This post truly made my day. You can not imagine just how much time I had spent for this information! Thanks!

  • Health and Fitness回复

    Somebody necessarily assist to make severely posts I'd state. That is the first time I frequented your website page and thus far? I amazed with the research you made to make this particular put up extraordinary. Wonderful job!

  • Health and Fitness回复

    I loved as much as you will receive carried out right here. The sketch is tasteful, your authored material stylish. nonetheless, you command get got an shakiness over that you wish be delivering the following. unwell unquestionably come further formerly again since exactly the same nearly very often inside case you shield this increase.

  • Health and Fitness回复

    I'm still learning from you, as I'm trying to achieve my goals. I absolutely love reading all that is posted on your site.Keep the aarticles coming. I enjoyed it!

  • Health and Fitness回复

    It's the best time to make some plans for the future and it's time to be happy. I have read this post and if I could I wish to suggest you some interesting things or suggestions. Perhaps you could write next articles referring to this article. I desire to read more things about it!

  • Health and Fitness回复

    I think this is one of the most significant information for me. And i am glad reading your article. But want to remark on few general things, The site style is ideal, the articles is really great : D. Good job, cheers

  • Health and Fitness回复

    hey there and thank you for your info – I’ve definitely picked up something new from right here. I did however expertise some technical points using this website, since I experienced to reload the website many times previous to I could get it to load properly. I had been wondering if your web host is OK? Not that I am complaining, but slow loading instances times will sometimes affect your placement in google and can damage your quality score if ads and marketing with Adwords. Anyway I am adding this RSS to my e-mail and could look out for much more of your respective interesting content. Make sure you update this again soon..

  • Health and Fitness回复

    Enjoyed reading this, very good stuff, regards . "Success doesn't come to you...you go to it." by Marva Collins.

  • Health and Fitness回复

    I have recently started a web site, the info you provide on this web site has helped me tremendously. Thanks for all of your time & work. "The very ink with which history is written is merely fluid prejudice." by Mark Twain.

  • Health and Fitness回复

    You really make it seem so easy with your presentation but I find this matter to be really something that I think I would never understand. It seems too complicated and very broad for me. I am looking forward for your next post, I will try to get the hang of it!

  • Web Design回复

    I have been absent for some time, but now I remember why I used to love this blog. Thank you, I'll try and check back more frequently. How frequently you update your web site?

  • Health and Fitness回复

    I precisely desired to appreciate you once again. I'm not certain the things that I might have handled without the actual creative concepts revealed by you over this area of interest. It seemed to be an absolute difficult case for me personally, but finding out your skilled tactic you managed it took me to jump over delight. I'm just happier for your advice and in addition hope that you find out what a powerful job you are undertaking educating men and women through the use of your web site. I am certain you haven't come across any of us.

  • Mobile Phones回复

    I have been exploring for a little bit for any high-quality articles or weblog posts in this sort of area . Exploring in Yahoo I finally stumbled upon this web site. Studying this information So i¡¦m happy to convey that I have a very good uncanny feeling I discovered exactly what I needed. I so much undoubtedly will make certain to do not put out of your mind this website and give it a glance regularly.

  • Web Design回复

    F*ckin' remarkable things here. I am very satisfied to look your article. Thanks a lot and i am taking a look ahead to touch you. Will you please drop me a e-mail?

  • tool cupboard storage回复

    always a big fan of linking to bloggers that I love but do not get a good deal of link really like from

  • Money Market回复

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

  • Web Design回复

    But a smiling visitant here to share the love (:, btw great style .

  • free streaming porn,回复

    Post writing is also a fun, if you know then you can write otherwise it is complicated to write.|

  • Web Design回复

    Unquestionably believe that which you said. Your favorite reason seemed to be on the net the simplest thing to be aware of. I say to you, I definitely get annoyed while people consider worries that they just do not know about. You managed to hit the nail upon the top and defined out the whole thing without having side-effects , people can take a signal. Will probably be back to get more. Thanks

  • Health and Fitness回复

    Very interesting information!Perfect just what I was looking for! "If you want to test your memory, try to recall what you were worrying about one year ago today." by Rotarian.

  • Health and Fitness回复

    Thank you a lot for sharing this with all of us you really recognize what you're speaking about! Bookmarked. Please also talk over with my web site =). We could have a link change agreement among us!

  • Health and Fitness回复

    I just could not leave your site before suggesting that I really enjoyed the standard information an individual supply on your visitors? Is going to be again frequently in order to inspect new posts.

  • Health and Fitness回复

    But wanna input on few general things, The website pattern is perfect, the written content is really great. "In business school classrooms they construct wonderful models of a nonworld." by Peter Drucker.