【发布时间】:2015-08-26 16:04:24
【问题描述】:
我正在使用 com.android.volley.toolbox.NetworkImageView。 图片来自网址。 我想显示图像,使其宽度占据屏幕的整个宽度而不是高度,因为在图像下方有一个 Textview 的标题。
这是活动的xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/black"
tools:context=".MainActivity" >
<android.support.v4.view.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
这里是项目 xml。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center" >
<com.android.volley.toolbox.NetworkImageView
android:id="@+id/photo_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="1dp"
android:src="@drawable/button_register" />
<TextView
android:id="@+id/caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/photo_image"
android:layout_marginLeft="15dp"
android:text="Check"
android:textColor="@color/white" />
</RelativeLayout>
从后端图像大小为 300 X 200 像素。 如何设置 imageview 以便它可以占据屏幕的整个宽度。 有人可以帮忙吗?
【问题讨论】:
标签: android android-layout android-volley