mardi 3 juin 2014

Image retrieved from remote not correctly displayed


Vote count:

0




I have a LinearLayout where i placed many Views. When the Activity starts, i have an empty ImageView, that will be filled later with an image retrieved by remote. It's the XML of the Activity. Please look at the second View (first ImageView): as you can see, i want to set it's width to match_parent



<LinearLayout xmlns:android="http://ift.tt/nIICcg"
android:id="@+id/layout_raccolta"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/bg_activity_main"
>


<TextView

android:id="@+id/raccdetailtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="22sp"
android:layout_marginBottom="20dp"
android:text="Dettagli del Punto di Raccolta"
android:textAlignment="center"
android:gravity="center"




/>
<ImageView

android:id="@+id/raccdetailimage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:gravity="center"
android:layout_gravity="center"
/>

<TextView

android:id="@+id/raccdetailloc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:layout_marginBottom="10dp"
android:textAlignment="center"
android:gravity="center"

/>


<TextView

android:id="@+id/raccdetailloccity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:layout_marginBottom="5dp"
android:textAlignment="center"
android:gravity="center"

/>



<TextView

android:id="@+id/raccdetailaddr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="18sp"
android:layout_marginBottom="10dp"
android:textAlignment="center"
android:gravity="center"

/>

<TextView

android:id="@+id/raccdetailcontacts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:layout_marginBottom="10dp"
android:text="Contatti"
android:textAlignment="center"
android:gravity="center"

/>

<TextView
android:id="@+id/callTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:layout_marginBottom="20dp"
android:textAlignment="center"
android:gravity="center"
/>


<TextView
android:id="@+id/mailTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:layout_marginBottom="20dp"
android:textAlignment="center"
android:gravity="center"
/>


<TextView
android:id="@+id/webTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:layout_marginBottom="20dp"
android:textAlignment="center"
android:gravity="center"
/>

<TextView
android:id="@+id/raccNote"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:layout_marginBottom="20dp"
/>


After the Activity is loaded, i get the image through an AsyncTask, then i call an Activity's method to set the image that was just retrieved.



((ImageView)findViewById(R.id.raccdetailimage)).setImageDrawable((Drawable)vect.elementAt(0));


The image is shown, but it's too small: i want it stretched to it's max. Since there's enough height to stretch it, why doesn't it stretch the image?



asked 21 secs ago

mark

92





Aucun commentaire:

Enregistrer un commentaire