自定义ImageView的MainActivity
package com.baidu.lianximyview;
import com.example.myimageview.MyImageView;
import android.os.Bundle;
import android.app.Activity;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MyImageView myImageView = (MyImageView)findViewById(R.id.imageview);
myImageView.setImageDrawable(getResources().getDrawable(R.drawable.p));
}
}