setImageBitmap hat keinen sichtbaren Effekt

Ich habe ein byte-array enthält ein Bild hergeholt aus dem Netz. Ich bin träge laden Sie Sie auf meine UI-Aktivität (oder versuche ich zumindest 😀 ) mit Bitmapfactory, BitmapDrawable und setImageDrawable. hier ist mein code:

RelativeLayout r =(RelativeLayout) adap.getGroupView(Integer.parseInt(groupPos), false, null, null);
ImageView iv = (ImageView) r.findViewById(R.id.imgGruppo);
Log.w("",""+raw_img.length);
Bitmap bm = BitmapFactory.decodeByteArray(raw_img, 0, raw_img.length);
Drawable drawable = new BitmapDrawable(bm);
Log.i("","pre setimage"); 
iv.setImageDrawable(drawable);
//added for testing only, with no effects.
//((ELA) Activity_Titoli_2.this.getExpandableListAdapter()).notifyDataSetChanged();
//ELA is my expandable list adapter
Log.i("","post setimage"+bm.getRowBytes()); //just to see that i have actual data in raw_img and such

hier ist die XML beteiligt

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/linearLayoutTitoli2_gruppo"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/textNomeGruppo"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:text="Large Text"
        android:textColor="#FF0000"
        android:padding="14dp"
        android:textAppearance="?android:attr/textAppearanceLarge"  />

    <TextView
        android:id="@+id/textNoteGruppo"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textNomeGruppo"
        android:paddingLeft="14dp"
        android:paddingRight="14dp"
        android:paddingBottom="7dp"
        android:text="Small Text"
        android:textAppearance="?android:attr/textAppearanceSmall" />

    <ImageView
        android:id="@+id/imgGruppo"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_alignParentRight="true"
        android:src="@drawable/icon"
        />

</RelativeLayout>

Habe ich Hinzugefügt, "android:src..." nur um zu prüfen, ob die Bildansicht sichtbar ist, und es ist. Das problem ist nur, ich kann es nicht ändern!
Ich habe versucht setImageBitmap werden, indem nur die bitmap, die ich erstellt habe, habe ich versucht setimageDrawable erstellen einer BitmapDrawable, aber keine Auswirkungen auf alle. keine Fehler, kein gar nichts.
Bitte, wo ist der Fehler??? danke

Würde es helfen, zu nennen, iv.invalidate() nach iv.setImageDrawable(drawable)?
wenn ich invalidate (), um den code, es ändert sich nichts
vielen Dank auch an den Kerl, der downvoted, ohne etwas zu sagen konstruktiv. prost, Mann.
Ich habe das gleiche Problem, hast du jemals herausfinden, was die Ursache dieses?
nope, sorry. Es passiert eine Menge von Jahren, in einer älteren android-version und ich habe einfach nicht daran erinnern. Auch wenn ich es nicht vergessen, ich denke, es wäre nicht mehr anwendbar.

InformationsquelleAutor STT LCU | 2011-11-07

Schreibe einen Kommentar