0

I have a button with a drawableTop which does not resize for different displays and get pushed out of view..

I've tried making using different layouts as buttons even attempted to use ViewTreeObserver, but noting seems to work well enough..

Result on hi-res displays (as expected)

enter image description here

Result on smaller displays (broken)

enter image description here

layout.xml

    <Button
        android:id="@+id/btn_6"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_margin="5dp"
        android:layout_weight="0.9"
        android:background="#31b8bf"
        android:drawableTop="@drawable/ble"
        android:padding="8sp"
        android:text="BLE"
        android:textColor="#ffffff"
        android:textSize="20sp" />
Edward Tattsyrup
  • 245
  • 1
  • 3
  • 15

1 Answers1

0

It seems to me as the same problem as here: https://stackoverflow.com/a/7538641/7331042

You should use a ImageButton and specify the image in android:src, and set android:scaletype to fitXY

..or do same programmatically.