안드로이드를 공부하고 있는데 어려운게 너무 많아서 이렇게 질문을 올립니다.
xml에서 SurfaceView 와 아이콘 여러개를 배치 하고,
함수에서 만들어놓은 SurfaceView 에다가 이미지 여러장을 뿌리고 싶은데,
이 SurfaceView 의 캔버스를 얻어오질 못하겠네요.
mai.xml에
<RelativeLayout
android:id = "@+id/RelativeLayout01"
android:layout_width = "wrap_content"
android:layout_height = "fill_parent">
<SurfaceView
android:id = "@+id/title_Menu"
android:layout_width = "fill_parent"
android:layout_height = "fill_parent"
android:layout_marginBottom = "45px"
android:background = "@drawable/title_bg"
android:gravity = "center_vertical|center_horizontal">
</SurfaceView>
<LinearLayout
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:id = "@+id/music_list"
android:layout_marginLeft = "6dp"
android:layout_marginRight = "6dp"
android:layout_alignParentBottom = "true">
<Button
android:layout_width = "fill_parent"
android:layout_height = "fill_parent"
android:layout_margin = "0dp"
android:layout_weight = "1"
android:background = "@drawable/icon0_off"
android:id = "@drawable/icon0_on"
android:onClick = "ClickHandler"/>
....
</LinearLayout>
</RelativeLayout>
</LinearLayout>
======================================
image.java
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
m_Title_View = (SurfaceView)findViewById(R.id.title_Menu);
m_Title_View.setBackgroundColor(0xff000000);
m_Holder = m_Title_View.getHolder();
canvas = m_Holder.lockCanvas();
자바에서 만든 뷰에 백그라운드를 칠해보면 색이 칠해지는데,
canvas 에 널 값이 들어오네요.
canvas 값을 구하고, 여기에 이미지를 뿌리고 싶은데 고수님들의 도움을 바랍니다.