int dw = getWindowManager().getDefaultDisplay().getWidth();
int dh = getWindowManager().getDefaultDisplay().getHeight();
cases.azoft.com/4-must-know-tools-for-effective-android-development/
以下所写皆为上述所描。
像王国维 在《人间词话》 中所说一样,一个 app开发也要经历几种阶段
1 Checking how a layout looks before running it on a device
2 Running code inspection tools such as Lint; finding hardly revealed code errors before compilation
3 Selecting options for bitmapped graphics for all the display resolutions and states (enabled, disabled, pressed etc.), and exporting them into different digital devices
4 Detecting memory leaks during the development stage in debugging app builds
1. Tools Attributes : 工具属性
关于 tools的使用 :
The Task: To check what the UI elements look like at the development stage without the risk of them showing up accidentally in the final build.
任务:在开发阶段检查UI元素的外观,而不会在最终版本中出现意外的风险。
也就是说为了方便开发者开发调试,最终不会打包到APK中。
解决方案:工具属性 有助于使用额外的命名空间来管理Android Studio,以便开发框架不将属性运行时版本传输到最终版本。
原先 Android开发人员只能使用一种方法来检查一个完成的布局 -也就是在设备上运行它,然后再整改。 然而,有一个很好的机会使用开发框架中内置的 工具属性 ,在我们的例子中是Android Studio
tools:context="com.susion.boring.xxActivity"
preview的时候能看到一些预览的主题效果。
tools:layout="@android:layout/list_content" // 预览时可以看得到一些布局
tools:textcolor 等等
![](https://img.haomeiwen.com/i4899879/6b0e9dc7d7ad1314.png)
网友评论