question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Image is squeezed on Android

See original GitHub issue

I noticed taht image is a bit squeezed because of the top and bottom bars and found a way to avoid it.

Here’s how my launch_screen.xml looks like now:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical"
>
  <ImageView 
    android:src="@drawable/launch_screen"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scaleType="centerCrop"
  >
  </ImageView>
</FrameLayout>

I am no Android developer and if there’s a way to optimize or simplify it, that would be great.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:50
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
mohamedabusreacommented, Jan 5, 2019

It worked for me but I noticed that it increases the image ratio to force it to fill the screen like “background-size: cover” in CSS and I prefer “background-size: contain” so here is the new code:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical"
  android:background="@color/splashBackground"
>
  <ImageView 
    android:src="@drawable/launch_screen"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scaleType="centerInside"
  >
  </ImageView>
</FrameLayout>
4reactions
orangecolouredcommented, Jul 15, 2017

@Jacse you are right. But still the image is squeezed if you use the layout from the docs. So I would at least place a note there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to De-Squeeze photos on Android : r/MOMENT - Reddit
Try Pictools app for photos (use Resize (Px) and multiply the pixel width by 1.33, make sure aspect ratio is not locked). Can...
Read more >
android: stretch image in imageview to fit screen
I have an imageview that has its height and width set to fill_parent with a linearlayout that has the same values set. So...
Read more >
Pixel feature request: Give us squeeze to take photos in ...
Pixel feature request: Give us squeeze to take photos in Google Camera ... Camera allows you to snap a quick photo with the...
Read more >
Best stretch the picture apps for android In 2022 - Softonic
Find out the best stretch the picture apps for android, including Pixlr Express, Photo Warp, Pixlr and other top answers suggested and ranked...
Read more >
Android Apps by Squeeze Cash on Google Play
Enjoy millions of the latest Android apps, games, music, movies, TV, books, magazines & more. Anytime, anywhere, across your devices.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found