Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/117.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android xml布局标记何时以及为什么应该实例化类的对象?_Android_Xml - Fatal编程技术网

Android xml布局标记何时以及为什么应该实例化类的对象?

Android xml布局标记何时以及为什么应该实例化类的对象?,android,xml,Android,Xml,我不知道什么时候让xml布局标记实例化类的对象,以及为什么有时必须这样做。我只需要解释或任何指南或教程请 例如: <com.example.camerasurface.CustomCameraView android:id="@+id/surfaceView" android:layout_width="fill_parent" android:layout_height="fill_parent" android:clickable="true"/>

我不知道什么时候让xml布局标记实例化类的对象,以及为什么有时必须这样做。我只需要解释或任何指南或教程请

例如:

<com.example.camerasurface.CustomCameraView
    android:id="@+id/surfaceView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:clickable="true"/>

让我们简单地说,在XML文件中执行的任何操作都是硬编码的

它不会在整个应用程序中更改。 因此,无论您希望在站点中使用什么硬编码常量,都可以在XML中声明

其余的动态工作可以在java中进行


希望这有帮助。

有教程吗?我在google上搜索“xml布局实例化对象”,但结果没有用。没有教程介绍可以在xml中实例化什么。它的用户偏好。很可能是布局相关的值,因为它们不会改变整个应用程序。