• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Help Image Button resize

  • Thread starter Thread starter Android Question
  • Start date Start date
A

Android Question

Guest
Hello,

I have a three image button controls containing three diff images with dimensions of 128px x 128px
They are placed in a FrameLayout with layout_gravity set to center_vertical (left, center and right). Meaning each button is in a diff column of the central row.

How do i make them resize according the device resolution but they should never exceed 128x128. For example, they overlap on my old experia because it has low resolution. However it looks fine on my samsung Xtab 3 and other newer devices.

Code:
<ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/imgImg" 
            android:src="@drawable/myimage"
            android:layout_gravity="left|center_vertical"
            android:background="@android:color/transparent"
            android:clickable="true"
            android:scaleType="fitCenter"
            android:padding="5dp"
            android:layout_marginBottom="40dp" />

Thank you so much
 
You'd get a better answer in our application development forum. This section is for general help & troubleshooting rather than development questions.
 
Back
Top Bottom