2

I have set the text for the button, But somehow it throws the following exception.

I could not able to find the exact reason for getting the below issue. I searched over google and other sources but there is no solution for this.

If anyone faced this problem already, please help me how to get solve the issue. Thank you in advance

java.lang.IllegalArgumentException: Layout: -72 < 0
at android.text.Layout.<init>(Layout.java:142)
PrasathBabu
  • 4,716
  • 4
  • 19
  • 35

3 Answers3

3

https://cs.android.com/android/_/android/platform/frameworks/base/+/b2d8eb58a29c331c23c57712af936a670cb61b33:core/java/android/text/Layout.java;l=253;drc=7ad499d00716f45fffdf7331493ed21d1b8d9b77

The context of this problem is that you're mistakenly laying out text for a negative width, which probably would probably come from setting the text of a degenerately sized button.

Take a look through the rest of the frames in the stack trace to get a better sense of how that width value of -72 is reaching this illegal argument check.

guest
  • 6,450
  • 30
  • 44
1

Somehow you try to set the width/height of you layout to negative number...

But can you upload you code here.

0

Please ensure that your text character length is fit to button.

Ankit Lathiya
  • 199
  • 1
  • 12
  • can you share your entire xml file ? – Susheel Tickoo Dec 20 '19 at 06:32
  • what is the size of android:textSize="@dimen/_12ssp"? generally the exception -x<0 is thrown when android expectes minimum value to be zero but is being served a value less than zero. Just for the sake of verification try with some fixed values first and then you can conclude. – Susheel Tickoo Dec 23 '19 at 04:27