<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ListView
android:id="@+id/listView"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</ListView>
</RelativeLayout>
**********************************************************************
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.loopj.android.image.SmartImageView
android:id="@+id/imageView"
android:layout_width="100dp"
android:layout_height="100dp" />
<TextView
android:id="@+id/textView_intro"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/imageView"
android:layout_marginBottom="27dp"
android:layout_toRightOf="@+id/imageView"
android:text="fffffffffffffffffffddddddddddddd" />
<TextView
android:id="@+id/textView_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/textView_intro"
android:layout_alignLeft="@+id/textView_intro"
android:layout_marginBottom="16dp"
android:text="fffffffffffffffffff" />
</RelativeLayout>
==================================================================================
package com.example.day_07_SmartImageView;
}
=====================================================================================================
适配器
/**
*
*/
package com.example.day_07_SmartImageView;
import java.util.List;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.day_07_SmartImageView.bean.NewsInfo;
import com.loopj.android.image.SmartImageView;
/**
* @author WJL
*
*/
public class MyAdapter extends BaseAdapter {
Context context; List<NewsInfo> list;
/**
* @param mainActivity
* @param list
*/
public MyAdapter(Context context, List<NewsInfo> list) {
this.context=context;
this.list=list;
}
/* (non-Javadoc)
* @see android.widget.Adapter#getCount()
*/
@Override
public int getCount() {
// TODO Auto-generated method stub
return list.size();
}
/* (non-Javadoc)
* @see android.widget.Adapter#getItem(int)
*/
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see android.widget.Adapter#getItemId(int)
*/
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
/* (non-Javadoc)
* @see android.widget.Adapter#getView(int, android.view.View, android.view.ViewGroup)
*/
@Override
public View getView(int position, View convertView, ViewGroup parent) {
convertView=View.inflate(context,R.layout.item, null);
SmartImageViewimageView= (SmartImageView) convertView.findViewById(R.id.imageView);
TextView textView_intro= (TextView) convertView.findViewById(R.id.textView_intro);
TextView textView_title= (TextView) convertView.findViewById(R.id.textView_title);
textView_intro.setText(list.get(position).intro);
textView_title.setText(list.get(position).title);
//使用SmartImageView展示网络图片,传入图片网络地址即可
imageView.setImageUrl(list.get(position).pic);
return convertView;
}
}