Set padding on xml lead to unexpected behaviour
See original GitHub issueHow to reproduce
- 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 :
Expected behaviour(taken from normal ImageView with scaletype fitXY)
What exactly happen?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@nofurylion of course, and yes please !
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