2013-01-22 125 views
0

我正在使用MonoDevelop for Android,并且有关于使用Android智能图像视图的问题。这里是WWW地址:http://loopj.com/android-smart-image-view/Android活动的xml布局

安装如下:

Add a SmartImageView to your activity’s xml layout:

<com.loopj.android.image.SmartImageView 
android:id="@+id/my_image" /> 

我可否有一些帮助来正确的做到这一点。我不确定在哪里放置此代码。我目前正在使用StandardControls示例和Gridview活动。

编辑

我已经加入了SmartImageView到XML布局文件。当我下面的代码行:

SmartImageView myImage = (SmartImageView) findViewById(R.id.my_image); 

我收到以下错误:

The type or namespace name 'SmartImageView' could not be found (are you missing a using directive or an assembly reference?)

安装说:

Download the latest .jar file from github and place it in your Android app’s libs/ folder

我没有一个库/文件夹中。我需要创建一个/ libs文件夹吗?如果是这样,我在哪里创建这个文件夹?另外,一旦我有这个文件夹,我是否将.jar文件的内容提取到文件夹中,或者将.jar文件放入文件夹中?

目前,我刚刚提取.class文件到该项目的其他.class文件的文件夹中。我很确定这是错的。

回答

0

转到您的Eclipse项目

Project->res->layout->your_activity_layout.xml 

添加SmartImageView您活动的your_activity_layout.xml布局就像这样:

<com.loopj.android.image.SmartImageView 
    android:id="@+id/my_image" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
/> 

编辑:

使用这种方式在你的活动。

SmartImageView myImage = (SmartImageView) findViewById(R.id.my_image); 

加载图像到从URL的观点:

myImage.setImageUrl("http://www..../XYZ.jpg"); 
+0

迪克西特,可以请你看看我编辑的问题吗? – Garry