fit image in grid css
.photo > img {
object-fit: cover;
width: 100%;
max-height: 100%;
}
fit image in grid css
.photo > img {
object-fit: cover;
width: 100%;
max-height: 100%;
}
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>
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us