모두 RSS 피드의 일부 이미지 데이터를 표시하고 싶습니다. 내 RSS 피드 코드가 피드에서 제대로로드되는 이미지를 잘 작동하지만 가로로 이미지를 표시 할 수 없습니까? 나는 갤러리와 함께 노력했지만 그 이미지를 넣을 수 없습니까? 같은 것을 성취 할 수있는 방법이 있습니까?항목을 가로로 표시 하시겠습니까?
또한 http://www.dev-smart.com/archives/34 링크를 참조하여 Horizontal ListView를 구현할 수 있지만 목록에 onClickListener를 구현할 수 없습니다. 제발 도와주세요. 고맙습니다.
내가 갤러리를위한 노력의 코드 ..
공용 클래스 ImageAdapter는 BaseAdapter {
int imageBackground;
private List<RSSIteam> objects = null;
private Context context;
public ImageAdapter(Context c)
{
context = c;
TypedArray ta = obtainStyledAttributes(R.styleable.Gallery1);
imageBackground = ta.getResourceId(R.styleable.Gallery1_android_galleryItemBackground, 1);
ta.recycle();
}
public ImageAdapter(Context context, int textViewResourceId, List<RSSIteam> objects)
{
super();
this.context = context;
this.objects = objects;
}
@Override
public int getCount()
{
return this.objects.size();
//return pics.length;
}
@Override
public Object getItem(int position)
{
return this.objects.get(position);
//return position;
}
@Override
public long getItemId(int position)
{
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
RSSIteam data = (RSSIteam) getItem(position);
String imageUrl = data.imageurl;
try
{
URL feedImage = new URL(imageUrl);
HttpURLConnection conn= (HttpURLConnection)feedImage.openConnection();
InputStream is = conn.getInputStream();
Bitmap img = BitmapFactory.decodeStream(is);
}
catch (MalformedURLException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
ImageView iv = new ImageView(context);
iv.setImageResource(img[position]); //here i am unable to set the image in particular position because it require int type array
iv.setScaleType(ImageView.ScaleType.FIT_XY);
iv.setLayoutParams(new Gallery.LayoutParams(90,70));
iv.setBackgroundResource(imageBackground);
return iv;
}
}
좋은 "나는 갤러리와 시도하지만에 이미지를 넣을 수없는 ... ???"작업을위한 전체 도움이 될 것입니다 코드 아래에이를 봐 - 시도한 코드 게시. – user370305