android里面的图片放在res/drawable-mdpi里面怎么引用?

Wangyufeng_scut 2013-01-22 05:06:58
我把图片放在文件夹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);
}
});
}
...全文
1423 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Wangyufeng_scut 2013-01-23
  • 打赏
  • 举报
回复
引用 3 楼 veardn 的回复:
刷新一下项目,重新编译下再试试
刷新后就出现了我导入的照片了
veardn 2013-01-23
  • 打赏
  • 举报
回复
刷新一下项目,重新编译下再试试
jialiry 2013-01-23
  • 打赏
  • 举报
回复
@drawable-mdpi/doroema改成@drawable/doroema;
天下布武8 2013-01-22
  • 打赏
  • 举报
回复
你得在程序里粘贴,而且要改成drawable,程序会根据终端的分辨率自动去找不同drawable文件夹下的图片。 可能是因为RatingBarActivity 这个界面本身就是空白的

80,354

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧