Android Studio / Intellij Tip of the Day

<1>Android Studio / Intellij Tip of the Day: tools:attribute

If you have ever entered some testing text in a TextView to see how it looks in the previewer, then this is for you.
For any attribute in the xml that has the pattern 'android:something="value"', you can add a new attribute named 'tools:something="value"' and it will be picked up by the previewer but ignored in your app. Then you can leave default values that makes sense to visualize the layout without impacting the final build. 

Two things that you should check using the tools namespace:
  1) Text that will be set at runtime (so that you don't try to visualize an empty layout)
  2) Stuff that is dynamically changed later (e.g. visibility)

To configure the tools namespace, put this in the root tag of your layout (under the android xmlns):
  xmlns:tools="http://schemas.android.com/tools"



<2>Android Studio / Intellij Tip of the Day: Use the Tab Key in Search Everywhere

Search everywhere is interesting: you only have to double tap the shift key and it will show you matching classes, files, symbols and even actions! However, if you want to select a method, you'll find it in the third category so you will end up pressing the down key many times.

One cool trick is to use the tab key to navigate quickly between sections. The first tab will get you to the "more" button so that you can expand the current category. The next time you press the tab key will get you to the next category.



<3>Quick android studio tip: Enable "CamelHumps" words in "Editor->General->Smart Keys" to navigate in method and field names with the "alt" or "ctrl" key.



<4>Android Studio Tip of the Day: The File Structure Popup

OSX: cmd+f12
Windows/Linux:ctrl+f12 
Other Keymap: Look up the shortcut to the right of this menu: Navigate → File Structure

The idea here is to show an outline of the current class and navigate in it. The best thing about it is that you can filter using your keyboard. This is a very efficient way to go to a method you know by name.

Additional tips:
 - You can use camel-case matching when typing to filter the list. Example: typing "oCr" would find "onCreate"
 - You can toggle a checkbox to also show anonymous classes. It could be useful in some cases like if you want to go directly to the onClick method in an OnClickListener.



From:https://plus.google.com/collection/wtO0PB?hl=zh-CN

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值