-4
如何裁剪或调整一幅图像?我的应用程序将从一台服务器接收图像,并且我对这些图像一无所知,我不知道尺寸,纵横比或尺寸。如果你能看到我有一个图像为正方形,一个图像为矩形,那么所有图像将显示在my list上。所以知道任何人我如何裁剪图像或如何使图像视图修复?因为我需要填写所有图像以看起来像相同的大小,东西like that。更确切地说,如果我收到一个图像为2000x2000,另一个图像为1024x300,则我希望将这些图像转换为在viewimage上具有像300x200这样的两个分辨率。Android,如何裁剪图像视图
这里是我的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>
如果有人知道我怎么能解决这个问题的请求告诉我。 :)