为什么ImageView中显示不了位图文件
1个回答
2016-11-09
展开全部
package com.amaker.ch03_resource.drawable;
import android.app.Activity;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.widget.ImageView;
public class TestBitmapActivity extends Activity {
private ImageView myImageView;
public void onCreat(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.test_bitmap);
myImageView=(ImageView)findViewById(R.id.bitmapImageView02);
Resources r=getResources();
Drawable d=r.getDrawable(R.drawable.moto);
myImageView.setImageDrawable(d);
}
}
import android.app.Activity;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.widget.ImageView;
public class TestBitmapActivity extends Activity {
private ImageView myImageView;
public void onCreat(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.test_bitmap);
myImageView=(ImageView)findViewById(R.id.bitmapImageView02);
Resources r=getResources();
Drawable d=r.getDrawable(R.drawable.moto);
myImageView.setImageDrawable(d);
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询