【发布时间】:2015-06-17 08:29:17
【问题描述】:
我试图弄清楚如何从 TheTVDB(例如 http://thetvdb.com/banners/graphical/84947-g6.jpg)获取电视横幅以适应屏幕宽度。这让我到了那里,但我不想让空白从设置边距:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
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>
但是,如果我删除android:layout_margin="8dp",我突然只加载了第一个横幅的一半,但其他横幅都没有出现。
我尝试将width 和/或height 设置为wrap_content 并删除margin 和scaleType,效果很好,但横幅不会横跨屏幕。
【问题讨论】:
-
您是否尝试将宽度设置为“match_parent”并将高度设置为“wrap_content”?
-
是的,我已经尝试同时设置它们以及其中一个。当我这样做时,它会将它们全部放入,但不会将它们拉伸。编辑:如果我按照你提到的方式设置它,它只显示第一条横幅的一半,没有其他内容。
标签: android xml image android-volley networkimageview