http://stackoverflow.com/questions/10185624/surfaceview-in-layout
I am just putting down the changes.
Replace surface view in the xml with LinearLayout.
<LinearLayout android:id="@+id/middleSurface" android:layout_width="wrap_content" android:layout_height="wrap_content" />
Get an instance of linear layout
LinearLayout surface = (LinearLayout)findViewById(R.id.surface);
Add the surface view's instance to LinearLayout
surface.addView(new MagnetView(this));
2,3 steps should be performed after setContentView(R.layout.main);
'Android' 카테고리의 다른 글
HOW TO DEBUG ANDROID WIDGETS (0) | 2013.05.18 |
---|---|
Custom view 생성 (0) | 2013.05.17 |
ndk hello world usage (0) | 2013.05.12 |
custom font setting (0) | 2013.05.07 |
Unable to execute dex: method ID not in [0, 0xffff]: 65536 Conversion (0) | 2013.04.30 |