自定义ImageView的MainActivity

时间:2022-06-30 19:12:53

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));
    }

}