2011-08-07 53 views
0

我想提出一個形象,在它的一層猶如一張地圖的一些圖像 和標記如何在android應用上創建圖層圖層?

Resources r = getResources(); 
     Drawable[] layers = new Drawable[2]; 
     layers[0] = r.getDrawable(R.drawable.sketch); 
     layers[1] = r.getDrawable(R.drawable.marker1); 
     layers[1].setBounds(0, 0, 3, 3); 
     LayerDrawable layerDrawable = new LayerDrawable(layers); 
     ImageView testimage = (ImageView)findViewById(R.id.image); 
     testimage.setImageDrawable(layerDrawable); 

回答

0

您需要的ImageView添加到ViewGroup中(AbsoluteLayout,RelativeLayout的)和指定的ViewGroup的背景圖像。

可以使用SurfaceView,並通過自己實現圖像於母公司的圖紙。

+0

但我將有動態數量的標記 – eyalb

+0

無所謂,添加一個RelativeLayout,然後動態地將ImageView添加到它。 – blejzz