編集:部分的な答え
両方のディメンションが xml に設定されている場合、期待どおりに動作します。たとえば、
android:layout_width="250dp"
android:layout_height="250dp"
1 つが wrap_content に残されている場合は、そうではありません。
元の投稿
これが私のレイアウトです:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal" >
<ImageView
android:id="@+id/board"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/board" />
</LinearLayout>
画面に表示される画像の寸法が正しいのはなぜですか (画面の高さ x 画面の高さは、正方形のビットマップであり、高さに match_parent を設定しているため)、しかし、ImageView.getWidth() および ImageView.getHeight() を呼び出すと、画面の寸法?
よろしくお願いします