Csa*_*abi 4 android image android-layout android-xml scaletype
我正在开发显示图像的应用程序,我需要创建一个以1:1宽高比显示大图像的视图.
首先,我有一些72x72
分辨率的缩略图.我已经把他们在ImageView
,但即使我添加参数android:width="fill_parent"
和android:height="wrap_content"
,图像也不会不的大小ImageView
,但只在中间居中.
我尝试添加参数android:scaleType="centerCrop"
,水平调整图像大小,但高度保持不变.
我怎么能设置我的ImageView
所有设备在所有设备上的宽度与父视图一样,它也应该是高度.
我可以以编程方式执行此操作,但我需要能够以XML格式执行此操作.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
// The ImageView I am talking about above
<ImageView
android:id="@+id/invitation_imageview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="1dp"
android:scaleType="centerCrop"
android:src="@drawable/face_woman_smile" />
<ImageView
android:id="@+id/invitation_avatar_view_1"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:src="@drawable/face_woman_smile"
android:scaleType="center"
android:layout_margin="1dp" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5643 次 |
最近记录: |