One*_*rld 22 android imageview android-image android-layout
我使用 Layout_width="fill_parent"和Layout_height="wrap content".如果图像比ImageView大,它将完全缩小尺寸.
但是,我从来没有努力升级较小的图像.我尝试了ScaleType和"AdjustViewBounds"的任意组合:它总是在图像视图的中间保持自己的大小.这是代码......
<LinearLayout
android:id="@+id/LinearLayout02"
android:layout_height="wrap_content"
android:background="@drawable/content_bg"
android:orientation="vertical"
android:padding="5dp"
android:layout_width="fill_parent"
android:layout_marginLeft="1px">
<ImageView
android:layout_height="wrap_content"
android:src="@drawable/test"
android:id="@+id/ImageViewTest"
android:layout_width="fill_parent"
android:adjustViewBounds="true"
android:scaleType="center"></ImageView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
小智 9
我刚刚找到了一种让它发挥作用的方法.
这适用于2.1(AVD)和4.1.2(设备)
<LinearLayout 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="fitCenter" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
<LinearLayout
android:layout_height="wrap_content"
Run Code Online (Sandbox Code Playgroud)
使用内部图像的原始大小。
尝试更大的东西或fill_parent
| 归档时间: |
|
| 查看次数: |
29078 次 |
| 最近记录: |