【发布时间】:2014-12-10 07:16:47
【问题描述】:
我有高度和宽度为 match_parent 的 Imageview。我需要水平中心的图像没有将宽度更改为 wrap_content。您可以更改父布局。
这是我的 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" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="matrix"
android:src="@drawable/ic_launcher" />
</RelativeLayout>
【问题讨论】:
-
只需将 android:layout_centerHorizontal="true" 属性添加到
标签: android android-layout android-imageview