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.

Set padding on xml lead to unexpected behaviour

See original GitHub issue

How to reproduce

  1. On xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="8dp"
    android:gravity="center"
    android:orientation="vertical"
    tools:context=".MainActivity">


    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

        <com.ortiz.touchview.TouchImageView
            android:id="@+id/myIV"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/border"
            android:src="@drawable/messi5"
            android:padding="16dp" />
    </LinearLayout>
</LinearLayout>

The result is : device-2019-09-07-070514

Expected behaviour(taken from normal ImageView with scaletype fitXY) device-2019-09-07-070848

Same issue here and here

What exactly happen?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

1reaction
hannesa2commented, Oct 18, 2019

And may I work on it ?

@nofurylion of course, and yes please !

0reactions
hannesa2commented, Oct 20, 2020

I close it, but when it’s not your issue, please re-open this issue again and update the sample pull request with your exact issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Two(2) ways to prevent padding from causing an overflow in ...
When padding is added to an element with a width or a height of 100% it causes that element to overflow. It's no...
Read more >
Why do Views lose padding when an xml ... - Stack Overflow
In Android you can set a Background via xml and anything is fine. In some special cases I have the need to set...
Read more >
Intrinsic padding on Android TextInputs is back, makes it hard ...
This padding appears to happen with any sort of value for alignItems set (without that, both components are the same height, but the...
Read more >
appcompat-v7 can't set padding on EditText or Spinner via xml ...
A reliable workaround I've found is to create a shape drawable that has padding and set it as the background for your EditText....
Read more >
What You Need to Know About Whitespace in XML - Oracle
You may notice that the whitespaces are not stripped if the XML elements has xml:space=" preserved" . This behavior is based on the...
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