How do I set the image to match sreen?

I am using android studio and set the view of the image to fit the screen using a relative background image. I am providing the top edge of the layout and I am setting the image view to fit the screen below the 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"
    />

      

+3


source to share


2 answers


Write the following ImageView tag to 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 Paddings from your parent layout tag to get the image as a non-screen image.

+5


source


Use the following code for a given image in full screen mode.



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

      

0


source







All Articles