Answers for "how to fix the width of image without * grid"

CSS
1

css grid auto resize on mobile

// Fit as many columns as you can in one row
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
Posted by: Guest on June-28-2021
0

image view auto size gridlayout

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
    android:id="@+id/first"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:weightSum="3" >

    <ImageView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"

        android:adjustViewBounds="true"
        android:background="@drawable/ic_launcher"
        android:scaleType="centerInside"
        android:text="1" />
    <ImageView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:adjustViewBounds="true"
        android:background="@drawable/ic_launcher"
        android:scaleType="centerInside"
        android:text="1" />

    <ImageView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:adjustViewBounds="true"
        android:background="@drawable/ic_launcher"
        android:scaleType="centerInside"
        android:text="1" />
</LinearLayout>
<LinearLayout
    android:id="@+id/second"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/first"
    android:weightSum="3" >

    <ImageView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:adjustViewBounds="true"
        android:background="@drawable/ic_launcher"
        android:scaleType="centerInside"
        android:text="1" />
    <ImageView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:adjustViewBounds="true"
        android:background="@drawable/ic_launcher"
        android:scaleType="centerInside"
        android:text="1" />
    <ImageView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:adjustViewBounds="true"
        android:background="@drawable/ic_launcher"
        android:scaleType="centerInside"
        android:text="1" />
</LinearLayout>
<LinearLayout
    android:id="@+id/third"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/second"
    android:weightSum="3" >

    <ImageView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:adjustViewBounds="true"
        android:background="@drawable/ic_launcher"
        android:scaleType="centerInside"
        android:text="1" />
    <ImageView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:adjustViewBounds="true"
        android:background="@drawable/ic_launcher"
        android:scaleType="centerInside"
        android:text="1" />

    <ImageView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:adjustViewBounds="true"
        android:background="@drawable/ic_launcher"
        android:scaleType="centerInside"
        android:text="1" />
</LinearLayout>
<LinearLayout
    android:id="@+id/fourth"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/third"
    android:weightSum="3" >

    <ImageView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:adjustViewBounds="true"
        android:background="@drawable/ic_launcher"
        android:scaleType="centerInside"
        android:text="1" />

    <ImageView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:adjustViewBounds="true"
        android:background="@drawable/ic_launcher"
        android:scaleType="centerInside"
        android:text="1" />

    <ImageView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:adjustViewBounds="true"
        android:background="@drawable/ic_launcher"
        android:scaleType="centerInside"
        android:text="1" />
</LinearLayout>
Posted by: Guest on December-25-2021

Code answers related to "how to fix the width of image without * grid"

Browse Popular Code Answers by Language