samedi 11 avril 2015

Android Stretching Images in NetworkImageView XML

I'm trying to figure out how to get TV banners from TheTVDB (example http://ift.tt/1z6atJG) to fit the screen width. This gets me the there but I don't want to have the white space from setting the margin:



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<com.android.volley.toolbox.NetworkImageView
android:id="@+id/poster"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="8dp"
android:scaleType="fitXY" />

</LinearLayout>


However if I remove the android:layout_margin="8dp" I suddenly just get half of the first banner loaded but none of the others appear.


I've tried setting it the width and/or height to wrap_content and removing the margin and scaleType, that works fine, but the banners do not stretch across the screen.


Aucun commentaire:

Enregistrer un commentaire