【问题标题】:Android Develope: How can I adjust images to the screen?Android 开发者:如何将图像调整到屏幕上?
【发布时间】:2013-10-07 16:10:10
【问题描述】:

尽管遵守了不同屏幕尺寸的规则,为什么图像仍会缩放。 您可以在 img 的右侧看到我的意思。

我的图片尺寸是[查看网址上的图片]。 http://s1.directupload.net/file/d/3403/gn3a7t8c_png.htm

我该如何解决这个问题?

抱歉我的英语不好,欢迎说德语和波兰语,但不是必须的。

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >

<TableRow
    android:id="@+id/tableRow1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:src="@drawable/img" />

    <ImageView
        android:id="@+id/imageView2"
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:src="@drawable/img" />

    <ImageView
        android:id="@+id/imageView3"
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:src="@drawable/img" />

    <ImageView
        android:id="@+id/imageView4"
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:src="@drawable/img" />

    <ImageView
        android:id="@+id/imageView5"
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:src="@drawable/img" />
</TableRow>

以及它在不同屏幕尺寸上的显示效果 [查看 url 上的图片]。 http://s14.directupload.net/file/d/3403/2wr22nng_png.htm

【问题讨论】:

    标签: android eclipse image screen image-size


    【解决方案1】:

    您可以使用android:scaleType 属性。要使图像完全适合图像视图,您可以使用如下方式

    android:scaleType="fitXY"
    

    还有这个

    <dimen name="activity_horizontal_margin">0dp</dimen>
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-06-08
    • 2012-11-28
    • 2015-10-08
    • 1970-01-01
    • 1970-01-01
    • 2017-03-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多