如何使用Java code,以显示Android的图片 [英] How to Show Image in Android using Java Code

查看:118
本文介绍了如何使用Java code,以显示Android的图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在Android中使用Java code不是XML来显示图像。
我一直在使用XML文件来完成的,但我的要求是使用
java的code,以获得更多的funcionality。

I am try to show a image in android using java code not xml. I have done it using xml file but my requirement is using java code to get more funcionality .

在此先感谢帮助........

thanks in advance for help........

推荐答案

您在Android的XML使用一个默认的ImageView,当你正在运行的应用程序,时间
在活动中,你必须写这code,因此将与其他图像替换你的形象。
检查以下code

You have to use one default imageview in android xml when you are running app that time in activity you have to write this code so it will replace you image with another image. Check following code

ImageView imgView=(ImageView) findViewById(R.id.default_imgView);
imgView.setImageResource(R.drawable.yourimagename);

这篇关于如何使用Java code,以显示Android的图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆