У вас есть два варианта для этого.
либо используйте ViewFlipper или галерею Android.
Я предпочитаю использовать галерею Android, так как она будет управляемой и лучше подходит.
В примере галереи Android по умолчанию, который вы найдете на сайте developer.android.com В используемом адаптере и в методе getView () возвращается ImageView.Вы манипулируете своим кодом таким образом, чтобы он возвращал раздутый XML-макет, как показано в следующем коде
class ImageAdapter extends BaseAdapter {
int mGalleryItemBackground;
private Context mContext;
public ImageAdapter(Context c) {
mContext = c;
TypedArray a = obtainStyledAttributes(R.styleable.HelloGallery);
mGalleryItemBackground = a.getResourceId(
R.styleable.HelloGallery_android_galleryItemBackground, 0);
a.recycle();
}
public int getCount() {
return 5;
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
convertView = LayoutInflater.from(mContext).inflate(R.layout.ownview, null);
return convertView;
}
}