开发者

Images in my Layout scale up but the should not. How can I prevent the Images to be scaled?

开发者 https://www.devze.com 2023-01-21 02:32 出处:网络
I have a RelativeLayout in which I have two images. The problem is the scale up. They are displayed way bigger than the are supposed to. Here is my layout:

I have a RelativeLayout in which I have two images. The problem is the scale up. They are displayed way bigger than the are supposed to. Here is my layout:

<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=&q开发者_运维技巧uot;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"/>

Can anybody tell me what I am doing wrong here?


The layout looks fine.

Where are you storing these images? For example, if you put them in the drawable-ldpi folder with the size you want, and then test on a emulator runing mdpi setting or hdpi settings the image will be bigger, you have to decide properly where to store them acording to your desing.

These tags dont need the xml name space, you can write them without that, that is only needed for the main tag of the xml file.

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

精彩评论

暂无评论...
验证码 换一张
取 消