【问题标题】:Images in my Layout scale up but the should not. How can I prevent the Images to be scaled?我的布局中的图像按比例放大,但不应该。如何防止图像被缩放?
【发布时间】:2011-04-30 06:14:20
【问题描述】:

我有一个 RelativeLayout,其中有两个图像。问题是扩大规模。它们的显示方式比预期的要大。这是我的布局:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gallery_batch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/batch_background">
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/icon_success"
    android:id="@+id/view_batch_icon"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_centerVertical="true"
    android:padding="5dp"
    android:layout_gravity="center_vertical"/>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/text_bereits_geladen"
    android:layout_toRightOf="@id/view_batch_icon"
    android:layout_centerVertical="true"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="5dp"/>

谁能告诉我我在这里做错了什么?

【问题讨论】:

    标签: android image scaling


    【解决方案1】:

    布局看起来不错。

    您将这些图像存储在哪里?例如,如果你把它们放在你想要的大小的 drawable-ldpi 文件夹中,然后在运行 mdpi 设置或 hdpi 设置的模拟器上测试图像会更大,你必须根据你的设计正确决定将它们存储在哪里.

    这些标签不需要xml名称空间,你可以不用它来编写它们,这只是xml文件的主标签需要的。

    <ImageView xmlns:android="http://schemas.android.com/apk/res/android"
    

    【讨论】:

    • 谢谢你!我在 drawables 文件夹中存储了一些图形,因为我希望对所有分辨率使用相同的图像。
    猜你喜欢
    • 2013-06-04
    • 1970-01-01
    • 2016-09-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-20
    • 2015-06-16
    • 2010-12-31
    相关资源
    最近更新 更多