相关疑难解决方法(0)

Android布局文件中的"工具:上下文"是什么?

从最新的ADT版本开始,我注意到布局XML文件上的这个新属性,例如:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    tools:context=".MainActivity" />
Run Code Online (Sandbox Code Playgroud)

什么是"工具:上下文"用于?

它怎么知道写在那里的活动的确切路径?它是否在清单中查看应用程序的包?

它仅限于扩展Context或仅扩展活动的类吗?它可用于ListView项目等吗?

xml android android-context android-layout android-tools-namespace

908
推荐指数
5
解决办法
23万
查看次数

工具有什么区别:文本和android:android中的文本

我刚才知道我们可以使用工具设置文本:text ="toolsText".在此之前我使用的是android:text ="androidText".

请告诉我1.这两个特征之间有什么区别2.哪一个最好用.3在ui渲染过程中有什么影响

android

27
推荐指数
1
解决办法
8219
查看次数

$ {packageName}.$ {activityClass}如何在布局XML文件中工作?

ADT现在生成具有以下属性的XML布局:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="${packageName}.${activityClass}" >
Run Code Online (Sandbox Code Playgroud)

设计工具如何知道它属于哪个类?

android adt android-layout android-xml

6
推荐指数
1
解决办法
2967
查看次数