RecyclerView
に画像を表示しています。画像のソースはMMSメッセージから取得したビットマップです。問題は、画像が表示されていないことです。絶対に何も表示されません。ここに私のonBindViewです:ImageView.setImageBitmapがRecyclerViewに画像を表示しない
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
// - get element from your dataset at this position
// - replace the contents of the view with that element
final String name = mDataset.get(position).getContact() ;
final MMSMessage message = mDataset.get(position);
holder.txtHeader.setText(name);
DateTime dateTime = new DateTime(message.getDate());
holder.txtDate.setText(dateTime.toString(Globals.generalSQLFormatterDT));
holder.txtText.setText(message.getBody());
holder.txtText.setVisibility(View.VISIBLE);
Bitmap bitmap = message.getBitmap();
if (bitmap != null) {
//bitmap is not null and I can see an image using Android Studio
bitmap =Bitmap.createScaledBitmap(bitmap, 120, 120, false);
holder.imgMMS.setImageBitmap(bitmap);
} else {
holder.imgMMS.setVisibility(View.GONE);
}
}
ImageViewのためのXML:
<ImageView
android:layout_below="@+id/thirdLine"
android:id="@+id/imageMMS"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="6dip"
android:contentDescription="TODO"
/>
私はhereを見て、任意の小さなサイズに画像を縮小しようとしました。私はそれがメモリ不足ではないとは思わない - 私はテストとしてランチャーのアイコンを入れてみました。私は間違って何をしていますか?
なぜ 'if'では' else'にアクションopossiteはありませんか? – Selvin
@Selvinあなたは何を意味するのか分かりませんか? –
「else」には1つの「action」しかありません... ifのopossiteアクションはどこですか...私はすべての同様の質問に対してペニーを取得したいと思います... – Selvin