首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

android里面的图片放在res/drawable-mdpi里面如何引用

2013-01-28 
android里面的图片放在res/drawable-mdpi里面怎么引用?我把图片放在文件夹drawable-mdpi里面(复制-粘贴进

android里面的图片放在res/drawable-mdpi里面怎么引用?
我把图片放在文件夹drawable-mdpi里面(复制-粘贴进去的),在ImageView里面要用它,但总是出现个红叉
<ImageView 
        android:id="@+id/imagebutton"
        android:src="@drawable-mdpi/doroema"  //被画红曲线了
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        />
改drawable也不行、
另外,我有另一个程序是要实现Activity的跳转,用按钮的监听器来实现。不知为什么运行后点击按钮界面是空白的?
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button bn = (Button)findViewById(R.id.seek_bar_button);
bn.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
Intent intent = new Intent();
intent.setClass(MainActivity.this,RatingBarActivity.class);
startActivity(intent);
   }
});
} android Activity drawable
[解决办法]
你得在程序里粘贴,而且要改成drawable,程序会根据终端的分辨率自动去找不同drawable文件夹下的图片。

可能是因为RatingBarActivity 这个界面本身就是空白的
[解决办法]
@drawable-mdpi/doroema改成@drawable/doroema;
[解决办法]
刷新一下项目,重新编译下再试试

热点排行