Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set imageview fit to sreen?

I have use the android studio and set the image view fit to screen using relative background image i give layout top margin and i set image view fit to screen below part

android:layout_width="fill_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"

android:background="@drawable/backgroud">

<ImageView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="500dp"
    android:background="@drawable/blacksquare"
    android:alpha=".33"
    />

like image 595
Aakash Avatar asked Mar 18 '23 06:03

Aakash


1 Answers

Write the Following ImageView Tag in your Parent Layout.

<ImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scaleType="fitXY"
    android:background="@drawable/blacksquare"
    />

and you can also remove the Paddings from your parent Layout Tag to get fit the Image View in screen without padding..

like image 77
Pravinsingh Waghela Avatar answered Mar 26 '23 03:03

Pravinsingh Waghela