【发布时间】:2015-02-26 18:54:31
【问题描述】:
我正在从我的应用程序的 SD 卡中获取图片。我正在使用 imageview 来显示图像。但是,由于我不知道图像是水平的还是垂直的,如何在 imageview 中适当地显示水平或垂直图像。谢谢
File img_file = new File(picture_path);
bm = BitmapFactory.decodeFile(img_file.getAbsolutePath());
iv2.setImageBitmap(bm);
图像视图 xml
<ImageView
android:id="@+id/iv_image2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:scaleType="fitXY"
android:adjustViewBounds="true"
/>
【问题讨论】:
标签: android