Anna
Anna

Reputation: 147

Same imageview size in xml - different on device

Please help me with strange issue. I have simple linear layout with three imageviews, with same sizes. It look normal in Android Studio design, but on the device third imageview has different size. How to fix it? p.s. image resources have same sizes

part of layout:

<LinearLayout android:layout_width="match_parent"
                              android:layout_height="60dp"
                              android:orientation="horizontal"
                              android:gravity="center"
                              android:layout_marginTop="16dp"
                              android:layout_marginBottom="16dp">
                    <ImageView android:id="@+id/twitterlb"
                               android:layout_height="match_parent"
                               android:layout_width="60dp"
                               android:src="@drawable/tw_circle" android:scaleType="fitCenter"/>
                    <ImageView android:id="@+id/facebooklb"
                               android:layout_height="match_parent"
                               android:layout_width="60dp"
                               android:src="@drawable/fb_circle" android:scaleType="fitCenter"
                               android:layout_marginLeft="16dp"
                               android:layout_marginRight="16dp"/>
                    <ImageView android:id="@+id/linkedinlb"
                               android:layout_height="match_parent"
                               android:layout_width="60dp"
                               android:src="@drawable/in_circle" android:scaleType="fitCenter"/>
                </LinearLayout>

in Android studio:

buttons looks same in Android studio

on device:

on device

Upvotes: 1

Views: 751

Answers (2)

Anna
Anna

Reputation: 147

Thanks guys, I finally solved the problem. The problem was: same similar res for drawable-mdpi, drawable-xxhdpi, drawable-nodpi, drawable-xxxhdpi, drawable-hdpi, drawable-ldpi, but different for drawable-xhdpi (5 pixels transparent frame)

Upvotes: 0

Orcun Sevsay
Orcun Sevsay

Reputation: 1473

 <ImageView android:id="@+id/linkedinlb"
                   android:layout_height="match_parent"
                   android:layout_width="60dp"
                   android:background="@drawable/in_circle"
                   android:scaleType="fitXY"/>

You may try to change scaleType's to fitXY.

Upvotes: 0

Related Questions