Android Studio / Intellij Tip of the Day
2017-08-24 14:06
453 查看
<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"
![](http://img.blog.csdn.net/20170824140457609)
<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.
![](http://img.blog.csdn.net/20170824142101735)
<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.
![](http://img.blog.csdn.net/20170824143351214)
<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.
![](http://img.blog.csdn.net/20170824145940494)
From:https://plus.google.com/collection/wtO0PB?hl=zh-CN
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
相关文章推荐
- Android Studio Tip of the Day
- Android Studio Tip of the day
- Android Studio Tip of the Day--Breakpoints
- Android Studio Tip of the Day(AS IDE每日小技巧,持续更新)
- Android Studio Tips Of the Day
- Android Studio Tips Of the Day - Roundup #2
- Android Studio Tips Of the Day - Roundup #3
- Android Studio Tips Of the Day - Roundup #1
- Android Studio Tips Of the Day – Roundup
- Android Studio Tips Of the Day – Roundup
- Android Studio Tips Of the Day – Roundup
- PowerTip of the Day-Adding Extra Information
- Error running app: This version of Android Studio is incompatible with the Gradle Plugin used. Try d
- Android Studio Build Error : This version of Android Studio is incompatible with the Gradle Plugin u
- PowerTip of the Day from powershell.com上周汇总(十)
- PowerTip of the Day from powershell.com上周汇总(四)
- Error running demo: This version of Android Studio is incompatible with the Gradle Plugin used.
- vimtips.txt 可以直接使用,无需任何修改 (TipofTheDay vim)
- PowerTip of the Day-Removing Empty Things
- PowerTip of the Day-How Much RAM Do You Have?