Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/317.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/180.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
Java eclipseandroid中视图类与xml的连接_Java_Android_Xml_Eclipse - Fatal编程技术网

Java eclipseandroid中视图类与xml的连接

Java eclipseandroid中视图类与xml的连接,java,android,xml,eclipse,Java,Android,Xml,Eclipse,我有gamefield.xml,我只想在画布上用onDraw()在gamefield.xml中画一个矩形。。。我一直在寻找答案,但没有任何效果 我能为此做些什么,。多谢各位 这是我的游戏场。我不认为它有用 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:orientation="ver

我有gamefield.xml,我只想在画布上用onDraw()在gamefield.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"
>

<View class= "cruz.jayson.bantumi.Board"
    android:id="@+id/myBoard"
    android:layout_width="fill_parent"
    android:layout_height="match_parent" 
    />

</LinearLayout>

根据,您的XML应该如下所示:

<cruz.jayson.bantumi.Board
    android:id="@+id/myBoard"
    android:layout_width="fill_parent"
    android:layout_height="match_parent" />


您可以在元素的名称中指定视图类,而不是在
class
属性中指定视图类。

define
不起作用。。