android:自定义View的使用(二)

package com.intbird.soft.unity.view.layer;


import com.intbird.soft.unity.R;


import android.app.Activity;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.os.Bundle;
import android.widget.ImageView;


public class ImageLayerList extends Activity {
	
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		findView();
	}
		
	private void findView(){
		Resources res=getResources();
		Drawable [] drawables=new Drawable[]{};
		drawables[0]=res.getDrawable(R.drawable.ic_launcher);
		drawables[1]=res.getDrawable(R.drawable.ic_launcher);
		LayerDrawable layer=new LayerDrawable(drawables);
		
		ImageView iv=new ImageView(this);
		iv.setImageDrawable(layer);
	}
}

猜你喜欢

转载自blog.csdn.net/intbird/article/details/38339965