我有一个只包含一个 ImageView
的活动。这个视图应该显示从 URL 加载的图像。我希望这个图片能够在顶部展示,并使用整个屏幕宽度。
我的布局文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/overview_bgColor" >
<ImageView
android:id="@+id/overview_image"
android:contentDescription="image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top|fill_horizontal"/>
</LinearLayout>
但是图片总是垂直居中显示。为什么呢?我想,使用top
应该可以将这个ImageView
放在屏幕顶部吧?
top
没有将图像视图放置在屏幕顶部? - paul_schaeferandroid:adjustViewBounds="true"
,还是android:adjustViewBounds="true"
隐式地将ImageView
放置在顶部? - paul_schaefer