如何在Android中以编程方式显示图像

时间:2012-04-28 10:07:02

标签: android

我想用文字显示图片。

t_s.setText("You will be shown a picture like this"+R.drawable.myimage);

这是我的代码,但不起作用,它显示的不是图像,而是数字..

2 个答案:

答案 0 :(得分:0)

t_s.setText("You will be shown a picture like this");
t_s.setImageResource(R.drawable.myimage);

如果您需要设置背景以查看

,请尝试这些代码

答案 1 :(得分:0)

您必须创建TextView和ImageView分隔。