0

これはできますか?

<ImageButton
    android:id="@+id/test_button"
    android:layout_width="70% of screen width"
    android:layout_height="whatever is needed for the image to keep its original aspect ratio"
    android:background="@drawable/image" />
4

1 に答える 1

0

次のようなものを使用できるはずです。

<ImageButton
    android:id="@+id/test_button"
    android:layout_width="200dp" // You can use any number here to use a specific size
                                 // You can use dp for density independent pixels
                                 // Or sp for screen independent pixels

    android:layout_height="wrap_content" // This will set the height to a size just big
                                         // enough to hold the image.
于 2012-06-14T18:15:10.630 に答える