android中的图像显示
我正在尝试在android中显示图像。过程是我正在从网络下载1个图像并尝试在屏幕上显示,我面临的问题是在活动屏幕中我无法设置内容视图和图像。以下是代码: main.xml:android中的图像显示,android,Android,我正在尝试在android中显示图像。过程是我正在从网络下载1个图像并尝试在屏幕上显示,我面临的问题是在活动屏幕中我无法设置内容视图和图像。以下是代码: main.xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent"
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />
</LinearLayout>
清理您的项目。有时它不需要R.java文件。使用Android Smart Image View。这是使用URL显示图像的最简单方法。下面是一个示例。只需使用project->clean清理项目即可。如果它仍然存在,请运行该项目,它们通常会消失。我清理了该项目并运行了它,但它显示了在运行之前修复项目中的问题。是吗?在Android中,您经常会遇到这样的错误。尝试重新启动eclipse,或者创建一个新项目,然后粘贴。嘿,试着点击Ctrl+Shift+o,你的错误可能会在生活教程中得到解决?我无法从这个URL获得它的工作
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.);---->Here i cant set as main
Bitmap bitmap = DownloadImage(
"http://www.allindiaflorist.com/imgs/arrangemen4.jpg");
ImageView img = (ImageView) findViewById(R.id.); //here i cant set the image id
img.setImageBitmap(bitmap);
}