[問題] main.xml中如何使用mysurfaceview

看板AndroidDev作者 (viable)時間14年前 (2012/03/08 19:09), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
因為我想在mysurfaceview上加幾個按鈕 所以要在xml中加入mysurfaceview,不過我發現在沒加按鈕進去,程式就不能work了 還要加什麼東西才能work嗎? > < (<-青筋)   ~"~ ^ 這是acitivity的oncreate: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); msv=(MySurfaceView)findViewById(R.id.MySurfaceView1); } 這是main.xml: <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:baselineAligned="false" android:orientation="horizontal" > <test2.test2.test2.Test2Activity.MrawSurfaceView android:id="@+id/mySurfaceView1" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </FrameLayout> -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 112.105.81.130 ※ 編輯: viable 來自: 112.105.81.130 (03/08 19:13) ※ 編輯: viable 來自: 123.204.215.103 (03/12 01:09)
文章代碼(AID): #1FM9DStK (AndroidDev)