Ich versuche, zwei verschiedene Bilder in einer einzigen Liste-View Zeile mit Volley, aber jedes Mal, wenn ich die gleichen Bilder in beiden Bild-Ansicht (Netzwerk-) Bild-Ansicht) und wenn ich auf ein Bild klicke, blicke auf die ganze Zeile. Ich bin neu in Android und Codierung bitte helfen.Wie bekomme ich zwei verschiedene Bilder in der Listview Zeile mit Volley
public class CustomListAdapter extends BaseAdapter {
private Activity activity;
private LayoutInflater inflater;
private List<Movie> movieItems;
ImageLoader imageLoader = MyApplication.getInstance().getImageLoader();
public CustomListAdapter(Activity activity, List<Movie> movieItems) {
this.activity = activity;
this.movieItems = movieItems;
}
@Override
public int getCount() {
return movieItems.size();
}
@Override
public Object getItem(int location) {
return movieItems.get(location);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (inflater == null)
inflater = (LayoutInflater) activity
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (convertView == null)
convertView = inflater.inflate(R.layout.list_row, null);
if (imageLoader == null)
imageLoader = MyApplication.getInstance().getImageLoader();
NetworkImageView thumbNail = (NetworkImageView) convertView
.findViewById(R.id.thumbnail);
NetworkImageView thumbNail2 = (NetworkImageView) convertView
.findViewById(R.id.thumbnail2);
// getting movie data for the row
Movie m = movieItems.get(position);
// thumbnail image
thumbNail.setImageUrl(m.getThumbnailUrl(), imageLoader);
thumbNail2.setImageUrl(m.getThumbnailUrl(), imageLoader);
// title
return convertView;
}
}
list_row
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="200dp"
android:weightSum="2"
android:layout_weight="1"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<com.android.volley.toolbox.NetworkImageView
android:id="@+id/thumbnail"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitXY"
android:layout_marginLeft="1dp"
android:layout_marginRight="1dp"
android:layout_marginTop="1dp" />
/>
<TextView
android:elevation="6dp"
android:id="@+id/category_title_one"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Title"
android:textSize="20dp"
android:layout_alignParentBottom="true"
android:layout_margin="12dp"
android:textColor="@android:color/white"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<com.android.volley.toolbox.NetworkImageView
android:id="@+id/thumbnail2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitXY"
android:layout_marginLeft="1dp"
android:layout_marginRight="1dp"
android:layout_marginTop="1dp"
android:layout_alignParentBottom="true" />
<TextView
android:elevation="6dp"
android:id="@+id/category_title_two"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Title"
android:textSize="20dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_margin="12dp"
android:textColor="@android:color/white"
/>
</RelativeLayout>
</LinearLayout>
post ur code hier? –
Wie poste ich ??? –
zeigen einige Code bitte –