1
我一直在关注如何做到这一点,从我所收集的信息来看,它不像123那么容易,因为表面视图只会在它上面绘制,人们说的解决方案是使用xml布局并进行布局,然后将该表面视图添加为子项,并将按钮添加为该子项。然而,我完全失去了这一点,我真的很想看到如何做到这一点的代码(我喜欢看例子和试验和错误的学习)。在SurfaceView上渲染按钮
我的XML文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:id="@+id/Menu"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Menu" />
<Android.Game.GameView
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</FrameLayout>
</LinearLayout>
我没有代码将在按钮除了你看到的XML内容(我已经做了很多尝试和错误的)。
项目是这样的:活动 - >的setContentView(表面观) - >渲染上的onDraw的GFX
是否有人可以帮助我,一旦我已经看到了如何做榜样这与1对象,我将能够做到与其他对象。
编辑 - 解决它 好,我已经成功地从这个岗位工作了http://www.mail-archive.com/[email protected]/msg11780.html
我不得不设置的内容视图到XML文件,以及一些结构添加到面视图,以便它会工作