【发布时间】:2015-12-03 01:12:03
【问题描述】:
如何裁剪或调整一张图片的大小?我的应用程序将从一台服务器接收图像,我对这些图像一无所知,我不知道大小、纵横比或尺寸。所有这些图像都将显示在my list 上,如果你能看到我有一张是正方形的,一张是长方形的。那么知道任何人我如何裁剪这些图像或如何修复图像视图?因为我需要填充所有图像以使其看起来大小相同,like that。更准确地说,如果我收到一张 2000x2000 的图像和一张 1024x300 的图像,我想将这些图像转换为在 viewimage 上同时具有类似 300x200 的一种分辨率。
这是我的 XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="0dp">
<RelativeLayout
android:id="@+id/layout_item_car"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0">
<ImageView
android:id="@+id/img_tail"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:gravity="fill"
android:scaleType="fitStart"/>
<TextView
android:id="@+id/tail_location"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:text="@string/color"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@android:color/holo_orange_light"
android:textSize="25dp"
android:textStyle="bold"
tools:targetApi="ice_cream_sandwich"/>
<TextView
android:id="@+id/tail_description"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/model"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@android:color/holo_orange_light"
android:textStyle="normal"
tools:targetApi="ice_cream_sandwich"/>
</RelativeLayout>
</LinearLayout>
如果有人知道我该如何解决这个问题,请告诉我。 :)
【问题讨论】:
标签: android android-layout android-listview android-imageview android-image