画像を表示するには次のxmlがあります。問題は、ページがロードされているときに、イメージビューの四角形が指定されたサイズでないことです。どうすれば修正できますか?たとえば、コードごとに150 x 150の矩形が必要です。正しいパラメータにもかかわらず、不適切な画像ビューサイズを表示する
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="2dp"
android:layout_marginTop="2dp"
android:layout_marginRight="2dp"
android:layout_marginBottom="2dp"
android:id="@+id/table_two">
<TableRow
android:padding="2dp"
android:layout_width="150dp"
android:layout_height="150dp">
<ImageView
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_weight="1"
app:srcCompat="@android:drawable/picture_frame"
android:id="@+id/ui_imageView_browse"
android:layout_gravity="center"
android:scaleType="fitXY" />
</TableRow>
</TableLayout>
</LinearLayout>
Pls。 https://stackoverflow.com/questions/9476662/how-to-set-android-layout-to-support-all-screen-sizes – user8256287
@JaysonJohnをチェックすると、さまざまな画面サイズのソリューションが表示されます。私の質問は、画面サイズやデバイスに関係なく、コードごとに固定サイズの四角形についてです。 – djac