java.lang.IllegalArgumentException: Rect should intersect with child's bounds





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







26















In Android Studio after starting a new project, and selecting a Tabbed Activity, after the project is build, I get this error in the Android Monitor:



E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.app, PID: 23581
java.lang.IllegalArgumentException: Rect should intersect with child's bounds.
at android.support.design.widget.CoordinatorLayout.offsetChildByInset(CoordinatorLayout.java:1319)
at android.support.design.widget.CoordinatorLayout.onChildViewsChanged(CoordinatorLayout.java:1257)
at android.support.design.widget.CoordinatorLayout$OnPreDrawListener.onPreDraw(CoordinatorLayout.java:1805)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:847)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1867)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:996)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5600)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
at android.view.Choreographer.doCallbacks(Choreographer.java:574)
at android.view.Choreographer.doFrame(Choreographer.java:544)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)


What does this exception mean, and how to fix it? It is a completely new project, so I have not made any change.










share|improve this question


















  • 4





    Looks like a bug in the framework: code.google.com/p/android/issues/detail?id=222597

    – Chisko
    Sep 16 '16 at 16:59













  • Less that a day ago! Must be a recent update :

    – goetzc
    Sep 16 '16 at 17:07











  • yeah... if this stops your development, try switching to a lower appcompat version

    – Chisko
    Sep 16 '16 at 17:23











  • According to the link above, this issue is resolved in support library v. 25.1.0

    – howettl
    Jan 3 '17 at 21:27


















26















In Android Studio after starting a new project, and selecting a Tabbed Activity, after the project is build, I get this error in the Android Monitor:



E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.app, PID: 23581
java.lang.IllegalArgumentException: Rect should intersect with child's bounds.
at android.support.design.widget.CoordinatorLayout.offsetChildByInset(CoordinatorLayout.java:1319)
at android.support.design.widget.CoordinatorLayout.onChildViewsChanged(CoordinatorLayout.java:1257)
at android.support.design.widget.CoordinatorLayout$OnPreDrawListener.onPreDraw(CoordinatorLayout.java:1805)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:847)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1867)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:996)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5600)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
at android.view.Choreographer.doCallbacks(Choreographer.java:574)
at android.view.Choreographer.doFrame(Choreographer.java:544)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)


What does this exception mean, and how to fix it? It is a completely new project, so I have not made any change.










share|improve this question


















  • 4





    Looks like a bug in the framework: code.google.com/p/android/issues/detail?id=222597

    – Chisko
    Sep 16 '16 at 16:59













  • Less that a day ago! Must be a recent update :

    – goetzc
    Sep 16 '16 at 17:07











  • yeah... if this stops your development, try switching to a lower appcompat version

    – Chisko
    Sep 16 '16 at 17:23











  • According to the link above, this issue is resolved in support library v. 25.1.0

    – howettl
    Jan 3 '17 at 21:27














26












26








26


4






In Android Studio after starting a new project, and selecting a Tabbed Activity, after the project is build, I get this error in the Android Monitor:



E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.app, PID: 23581
java.lang.IllegalArgumentException: Rect should intersect with child's bounds.
at android.support.design.widget.CoordinatorLayout.offsetChildByInset(CoordinatorLayout.java:1319)
at android.support.design.widget.CoordinatorLayout.onChildViewsChanged(CoordinatorLayout.java:1257)
at android.support.design.widget.CoordinatorLayout$OnPreDrawListener.onPreDraw(CoordinatorLayout.java:1805)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:847)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1867)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:996)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5600)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
at android.view.Choreographer.doCallbacks(Choreographer.java:574)
at android.view.Choreographer.doFrame(Choreographer.java:544)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)


What does this exception mean, and how to fix it? It is a completely new project, so I have not made any change.










share|improve this question














In Android Studio after starting a new project, and selecting a Tabbed Activity, after the project is build, I get this error in the Android Monitor:



E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.app, PID: 23581
java.lang.IllegalArgumentException: Rect should intersect with child's bounds.
at android.support.design.widget.CoordinatorLayout.offsetChildByInset(CoordinatorLayout.java:1319)
at android.support.design.widget.CoordinatorLayout.onChildViewsChanged(CoordinatorLayout.java:1257)
at android.support.design.widget.CoordinatorLayout$OnPreDrawListener.onPreDraw(CoordinatorLayout.java:1805)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:847)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1867)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:996)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5600)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
at android.view.Choreographer.doCallbacks(Choreographer.java:574)
at android.view.Choreographer.doFrame(Choreographer.java:544)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)


What does this exception mean, and how to fix it? It is a completely new project, so I have not made any change.







android android-layout dalvik






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Sep 16 '16 at 16:48









goetzcgoetzc

8331422




8331422








  • 4





    Looks like a bug in the framework: code.google.com/p/android/issues/detail?id=222597

    – Chisko
    Sep 16 '16 at 16:59













  • Less that a day ago! Must be a recent update :

    – goetzc
    Sep 16 '16 at 17:07











  • yeah... if this stops your development, try switching to a lower appcompat version

    – Chisko
    Sep 16 '16 at 17:23











  • According to the link above, this issue is resolved in support library v. 25.1.0

    – howettl
    Jan 3 '17 at 21:27














  • 4





    Looks like a bug in the framework: code.google.com/p/android/issues/detail?id=222597

    – Chisko
    Sep 16 '16 at 16:59













  • Less that a day ago! Must be a recent update :

    – goetzc
    Sep 16 '16 at 17:07











  • yeah... if this stops your development, try switching to a lower appcompat version

    – Chisko
    Sep 16 '16 at 17:23











  • According to the link above, this issue is resolved in support library v. 25.1.0

    – howettl
    Jan 3 '17 at 21:27








4




4





Looks like a bug in the framework: code.google.com/p/android/issues/detail?id=222597

– Chisko
Sep 16 '16 at 16:59







Looks like a bug in the framework: code.google.com/p/android/issues/detail?id=222597

– Chisko
Sep 16 '16 at 16:59















Less that a day ago! Must be a recent update :

– goetzc
Sep 16 '16 at 17:07





Less that a day ago! Must be a recent update :

– goetzc
Sep 16 '16 at 17:07













yeah... if this stops your development, try switching to a lower appcompat version

– Chisko
Sep 16 '16 at 17:23





yeah... if this stops your development, try switching to a lower appcompat version

– Chisko
Sep 16 '16 at 17:23













According to the link above, this issue is resolved in support library v. 25.1.0

– howettl
Jan 3 '17 at 21:27





According to the link above, this issue is resolved in support library v. 25.1.0

– howettl
Jan 3 '17 at 21:27












6 Answers
6






active

oldest

votes


















20














After updating the new appcompat version to 24.2.1 i had the same bug,
Try to lower the version to 24.1.1 or even to a stable 23 version.






share|improve this answer



















  • 6





    Yes that's correct, the error occurs after upgrading to version 24.2.1. Go to your app/build.gradle and change to this 'compile 'com.android.support:appcompat-v7:24.2.0

    – macbee
    Oct 5 '16 at 7:32






  • 5





    Same problem with 25.0.0... Another bug taken seriously by Google

    – Yoann Hercouet
    Oct 26 '16 at 20:47






  • 3





    Yeah I got the same problem with appcompat-v7:25.0.0

    – Orcun Sevsay
    Oct 31 '16 at 12:47











  • if I use com.android.support:appcompat-v7:24.2.0 app crashes for a different reason. It works fine with com.android.support:appcompat-v7:24.1.0. The exception is java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.support.design.widget.CoordinatorLayout$LayoutParams

    – kingston
    Nov 14 '16 at 10:09











  • yes 24.1.1 working..

    – Ranjith Kumar
    Feb 26 '17 at 16:42



















9














In my case the problem was caused because of FloatingActionButton.Behavior.



Here the code inside coordinator layout



  if (behavior != null && behavior.getInsetDodgeRect(this, child, rect)) {
// Make sure that it intersects the views bounds
if (!rect.intersect(child.getLeft(), child.getTop(),
child.getRight(), child.getBottom())) {
throw new IllegalArgumentException("Rect should intersect with child's bounds.");
}
}


And here the code inside of FloatingActionButton.Behavior



    @Override
public boolean getInsetDodgeRect(@NonNull CoordinatorLayout parent,
@NonNull FloatingActionButton child, @NonNull Rect rect) {
// Since we offset so that any internal shadow padding isn't shown, we need to make
// sure that the shadow isn't used for any dodge inset calculations
final Rect shadowPadding = child.mShadowPadding;
rect.set(child.getLeft() + shadowPadding.left,
child.getTop() + shadowPadding.top,
child.getRight() - shadowPadding.right,
child.getBottom() - shadowPadding.bottom);
return true;
}


As you can see getInsetDodgeRect was returning true and by some reason rect was not intersecting. This causes the problem.



The workaround.



I could fix it just extending the behavior and overwriting the method getInsetDodgeRect to return false;



public class ScrollAwareFABBehavior extends FloatingActionButton.Behavior {
...
@Override
public boolean getInsetDodgeRect(@NonNull CoordinatorLayout parent, @NonNull FloatingActionButton child, @NonNull Rect rect) {
super.getInsetDodgeRect(parent, child, rect);
return false;
}
...





share|improve this answer
























  • How do you set the ScrollAwareFABBehavior to the FloatingActionButton?

    – Bernd Kampl
    Nov 16 '16 at 10:01






  • 1





    <android.support.design.widget.FloatingActionButton app:layout_behavior="com.your.package.ScrollAwareFABBehavior"/>

    – jDur
    Nov 16 '16 at 10:57













  • Using it like this results in a crash on startup with InflateException: Binary XML file: Could not inflate Behavior subclass com.mypackage.etc.ScrollAwareFABBehavior

    – Bernd Kampl
    Nov 23 '16 at 12:46













  • I was missing the Constructors, having the following now works: pastebin.com/UAzGYyYE

    – Bernd Kampl
    Nov 23 '16 at 13:22













  • As of appcompat support version 25.0.1 the bug is still present. The fix you provided works quite well. No need to use an old library. Thank you!

    – Grux
    Dec 1 '16 at 19:28



















7














It's a bug introduced in support library 24.2.1, see here.



Known workarounds:




  • Downgrade to a different support library version






share|improve this answer
























  • User Chisko already provided this information, take a look at the first comment on the question.

    – goetzc
    Sep 22 '16 at 15:49











  • @goetzc Providing it as an answer is better. You can now mark this correct so it shows up as the best way to handle this issue.

    – Jared Burrows
    Oct 26 '16 at 16:29



















3














The bug have been fixed in 25.1.0






share|improve this answer
























  • I am still facing it in 25.1.0. Any solution yet ?

    – SimpleCoder
    Feb 14 '17 at 2:39





















1














The problem is present when used a layout based on a old version appcompat, look the layout xml file and edit it. Erase tools:context atribut and the problem is solved.






share|improve this answer































    0














    i was getting the same error but some how uninstalling the app and re running it again helped solve it






    share|improve this answer
























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f39536519%2fjava-lang-illegalargumentexception-rect-should-intersect-with-childs-bounds%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      6 Answers
      6






      active

      oldest

      votes








      6 Answers
      6






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      20














      After updating the new appcompat version to 24.2.1 i had the same bug,
      Try to lower the version to 24.1.1 or even to a stable 23 version.






      share|improve this answer



















      • 6





        Yes that's correct, the error occurs after upgrading to version 24.2.1. Go to your app/build.gradle and change to this 'compile 'com.android.support:appcompat-v7:24.2.0

        – macbee
        Oct 5 '16 at 7:32






      • 5





        Same problem with 25.0.0... Another bug taken seriously by Google

        – Yoann Hercouet
        Oct 26 '16 at 20:47






      • 3





        Yeah I got the same problem with appcompat-v7:25.0.0

        – Orcun Sevsay
        Oct 31 '16 at 12:47











      • if I use com.android.support:appcompat-v7:24.2.0 app crashes for a different reason. It works fine with com.android.support:appcompat-v7:24.1.0. The exception is java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.support.design.widget.CoordinatorLayout$LayoutParams

        – kingston
        Nov 14 '16 at 10:09











      • yes 24.1.1 working..

        – Ranjith Kumar
        Feb 26 '17 at 16:42
















      20














      After updating the new appcompat version to 24.2.1 i had the same bug,
      Try to lower the version to 24.1.1 or even to a stable 23 version.






      share|improve this answer



















      • 6





        Yes that's correct, the error occurs after upgrading to version 24.2.1. Go to your app/build.gradle and change to this 'compile 'com.android.support:appcompat-v7:24.2.0

        – macbee
        Oct 5 '16 at 7:32






      • 5





        Same problem with 25.0.0... Another bug taken seriously by Google

        – Yoann Hercouet
        Oct 26 '16 at 20:47






      • 3





        Yeah I got the same problem with appcompat-v7:25.0.0

        – Orcun Sevsay
        Oct 31 '16 at 12:47











      • if I use com.android.support:appcompat-v7:24.2.0 app crashes for a different reason. It works fine with com.android.support:appcompat-v7:24.1.0. The exception is java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.support.design.widget.CoordinatorLayout$LayoutParams

        – kingston
        Nov 14 '16 at 10:09











      • yes 24.1.1 working..

        – Ranjith Kumar
        Feb 26 '17 at 16:42














      20












      20








      20







      After updating the new appcompat version to 24.2.1 i had the same bug,
      Try to lower the version to 24.1.1 or even to a stable 23 version.






      share|improve this answer













      After updating the new appcompat version to 24.2.1 i had the same bug,
      Try to lower the version to 24.1.1 or even to a stable 23 version.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Sep 19 '16 at 14:27









      Yevgniy ShvartsmanYevgniy Shvartsman

      1977




      1977








      • 6





        Yes that's correct, the error occurs after upgrading to version 24.2.1. Go to your app/build.gradle and change to this 'compile 'com.android.support:appcompat-v7:24.2.0

        – macbee
        Oct 5 '16 at 7:32






      • 5





        Same problem with 25.0.0... Another bug taken seriously by Google

        – Yoann Hercouet
        Oct 26 '16 at 20:47






      • 3





        Yeah I got the same problem with appcompat-v7:25.0.0

        – Orcun Sevsay
        Oct 31 '16 at 12:47











      • if I use com.android.support:appcompat-v7:24.2.0 app crashes for a different reason. It works fine with com.android.support:appcompat-v7:24.1.0. The exception is java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.support.design.widget.CoordinatorLayout$LayoutParams

        – kingston
        Nov 14 '16 at 10:09











      • yes 24.1.1 working..

        – Ranjith Kumar
        Feb 26 '17 at 16:42














      • 6





        Yes that's correct, the error occurs after upgrading to version 24.2.1. Go to your app/build.gradle and change to this 'compile 'com.android.support:appcompat-v7:24.2.0

        – macbee
        Oct 5 '16 at 7:32






      • 5





        Same problem with 25.0.0... Another bug taken seriously by Google

        – Yoann Hercouet
        Oct 26 '16 at 20:47






      • 3





        Yeah I got the same problem with appcompat-v7:25.0.0

        – Orcun Sevsay
        Oct 31 '16 at 12:47











      • if I use com.android.support:appcompat-v7:24.2.0 app crashes for a different reason. It works fine with com.android.support:appcompat-v7:24.1.0. The exception is java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.support.design.widget.CoordinatorLayout$LayoutParams

        – kingston
        Nov 14 '16 at 10:09











      • yes 24.1.1 working..

        – Ranjith Kumar
        Feb 26 '17 at 16:42








      6




      6





      Yes that's correct, the error occurs after upgrading to version 24.2.1. Go to your app/build.gradle and change to this 'compile 'com.android.support:appcompat-v7:24.2.0

      – macbee
      Oct 5 '16 at 7:32





      Yes that's correct, the error occurs after upgrading to version 24.2.1. Go to your app/build.gradle and change to this 'compile 'com.android.support:appcompat-v7:24.2.0

      – macbee
      Oct 5 '16 at 7:32




      5




      5





      Same problem with 25.0.0... Another bug taken seriously by Google

      – Yoann Hercouet
      Oct 26 '16 at 20:47





      Same problem with 25.0.0... Another bug taken seriously by Google

      – Yoann Hercouet
      Oct 26 '16 at 20:47




      3




      3





      Yeah I got the same problem with appcompat-v7:25.0.0

      – Orcun Sevsay
      Oct 31 '16 at 12:47





      Yeah I got the same problem with appcompat-v7:25.0.0

      – Orcun Sevsay
      Oct 31 '16 at 12:47













      if I use com.android.support:appcompat-v7:24.2.0 app crashes for a different reason. It works fine with com.android.support:appcompat-v7:24.1.0. The exception is java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.support.design.widget.CoordinatorLayout$LayoutParams

      – kingston
      Nov 14 '16 at 10:09





      if I use com.android.support:appcompat-v7:24.2.0 app crashes for a different reason. It works fine with com.android.support:appcompat-v7:24.1.0. The exception is java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.support.design.widget.CoordinatorLayout$LayoutParams

      – kingston
      Nov 14 '16 at 10:09













      yes 24.1.1 working..

      – Ranjith Kumar
      Feb 26 '17 at 16:42





      yes 24.1.1 working..

      – Ranjith Kumar
      Feb 26 '17 at 16:42













      9














      In my case the problem was caused because of FloatingActionButton.Behavior.



      Here the code inside coordinator layout



        if (behavior != null && behavior.getInsetDodgeRect(this, child, rect)) {
      // Make sure that it intersects the views bounds
      if (!rect.intersect(child.getLeft(), child.getTop(),
      child.getRight(), child.getBottom())) {
      throw new IllegalArgumentException("Rect should intersect with child's bounds.");
      }
      }


      And here the code inside of FloatingActionButton.Behavior



          @Override
      public boolean getInsetDodgeRect(@NonNull CoordinatorLayout parent,
      @NonNull FloatingActionButton child, @NonNull Rect rect) {
      // Since we offset so that any internal shadow padding isn't shown, we need to make
      // sure that the shadow isn't used for any dodge inset calculations
      final Rect shadowPadding = child.mShadowPadding;
      rect.set(child.getLeft() + shadowPadding.left,
      child.getTop() + shadowPadding.top,
      child.getRight() - shadowPadding.right,
      child.getBottom() - shadowPadding.bottom);
      return true;
      }


      As you can see getInsetDodgeRect was returning true and by some reason rect was not intersecting. This causes the problem.



      The workaround.



      I could fix it just extending the behavior and overwriting the method getInsetDodgeRect to return false;



      public class ScrollAwareFABBehavior extends FloatingActionButton.Behavior {
      ...
      @Override
      public boolean getInsetDodgeRect(@NonNull CoordinatorLayout parent, @NonNull FloatingActionButton child, @NonNull Rect rect) {
      super.getInsetDodgeRect(parent, child, rect);
      return false;
      }
      ...





      share|improve this answer
























      • How do you set the ScrollAwareFABBehavior to the FloatingActionButton?

        – Bernd Kampl
        Nov 16 '16 at 10:01






      • 1





        <android.support.design.widget.FloatingActionButton app:layout_behavior="com.your.package.ScrollAwareFABBehavior"/>

        – jDur
        Nov 16 '16 at 10:57













      • Using it like this results in a crash on startup with InflateException: Binary XML file: Could not inflate Behavior subclass com.mypackage.etc.ScrollAwareFABBehavior

        – Bernd Kampl
        Nov 23 '16 at 12:46













      • I was missing the Constructors, having the following now works: pastebin.com/UAzGYyYE

        – Bernd Kampl
        Nov 23 '16 at 13:22













      • As of appcompat support version 25.0.1 the bug is still present. The fix you provided works quite well. No need to use an old library. Thank you!

        – Grux
        Dec 1 '16 at 19:28
















      9














      In my case the problem was caused because of FloatingActionButton.Behavior.



      Here the code inside coordinator layout



        if (behavior != null && behavior.getInsetDodgeRect(this, child, rect)) {
      // Make sure that it intersects the views bounds
      if (!rect.intersect(child.getLeft(), child.getTop(),
      child.getRight(), child.getBottom())) {
      throw new IllegalArgumentException("Rect should intersect with child's bounds.");
      }
      }


      And here the code inside of FloatingActionButton.Behavior



          @Override
      public boolean getInsetDodgeRect(@NonNull CoordinatorLayout parent,
      @NonNull FloatingActionButton child, @NonNull Rect rect) {
      // Since we offset so that any internal shadow padding isn't shown, we need to make
      // sure that the shadow isn't used for any dodge inset calculations
      final Rect shadowPadding = child.mShadowPadding;
      rect.set(child.getLeft() + shadowPadding.left,
      child.getTop() + shadowPadding.top,
      child.getRight() - shadowPadding.right,
      child.getBottom() - shadowPadding.bottom);
      return true;
      }


      As you can see getInsetDodgeRect was returning true and by some reason rect was not intersecting. This causes the problem.



      The workaround.



      I could fix it just extending the behavior and overwriting the method getInsetDodgeRect to return false;



      public class ScrollAwareFABBehavior extends FloatingActionButton.Behavior {
      ...
      @Override
      public boolean getInsetDodgeRect(@NonNull CoordinatorLayout parent, @NonNull FloatingActionButton child, @NonNull Rect rect) {
      super.getInsetDodgeRect(parent, child, rect);
      return false;
      }
      ...





      share|improve this answer
























      • How do you set the ScrollAwareFABBehavior to the FloatingActionButton?

        – Bernd Kampl
        Nov 16 '16 at 10:01






      • 1





        <android.support.design.widget.FloatingActionButton app:layout_behavior="com.your.package.ScrollAwareFABBehavior"/>

        – jDur
        Nov 16 '16 at 10:57













      • Using it like this results in a crash on startup with InflateException: Binary XML file: Could not inflate Behavior subclass com.mypackage.etc.ScrollAwareFABBehavior

        – Bernd Kampl
        Nov 23 '16 at 12:46













      • I was missing the Constructors, having the following now works: pastebin.com/UAzGYyYE

        – Bernd Kampl
        Nov 23 '16 at 13:22













      • As of appcompat support version 25.0.1 the bug is still present. The fix you provided works quite well. No need to use an old library. Thank you!

        – Grux
        Dec 1 '16 at 19:28














      9












      9








      9







      In my case the problem was caused because of FloatingActionButton.Behavior.



      Here the code inside coordinator layout



        if (behavior != null && behavior.getInsetDodgeRect(this, child, rect)) {
      // Make sure that it intersects the views bounds
      if (!rect.intersect(child.getLeft(), child.getTop(),
      child.getRight(), child.getBottom())) {
      throw new IllegalArgumentException("Rect should intersect with child's bounds.");
      }
      }


      And here the code inside of FloatingActionButton.Behavior



          @Override
      public boolean getInsetDodgeRect(@NonNull CoordinatorLayout parent,
      @NonNull FloatingActionButton child, @NonNull Rect rect) {
      // Since we offset so that any internal shadow padding isn't shown, we need to make
      // sure that the shadow isn't used for any dodge inset calculations
      final Rect shadowPadding = child.mShadowPadding;
      rect.set(child.getLeft() + shadowPadding.left,
      child.getTop() + shadowPadding.top,
      child.getRight() - shadowPadding.right,
      child.getBottom() - shadowPadding.bottom);
      return true;
      }


      As you can see getInsetDodgeRect was returning true and by some reason rect was not intersecting. This causes the problem.



      The workaround.



      I could fix it just extending the behavior and overwriting the method getInsetDodgeRect to return false;



      public class ScrollAwareFABBehavior extends FloatingActionButton.Behavior {
      ...
      @Override
      public boolean getInsetDodgeRect(@NonNull CoordinatorLayout parent, @NonNull FloatingActionButton child, @NonNull Rect rect) {
      super.getInsetDodgeRect(parent, child, rect);
      return false;
      }
      ...





      share|improve this answer













      In my case the problem was caused because of FloatingActionButton.Behavior.



      Here the code inside coordinator layout



        if (behavior != null && behavior.getInsetDodgeRect(this, child, rect)) {
      // Make sure that it intersects the views bounds
      if (!rect.intersect(child.getLeft(), child.getTop(),
      child.getRight(), child.getBottom())) {
      throw new IllegalArgumentException("Rect should intersect with child's bounds.");
      }
      }


      And here the code inside of FloatingActionButton.Behavior



          @Override
      public boolean getInsetDodgeRect(@NonNull CoordinatorLayout parent,
      @NonNull FloatingActionButton child, @NonNull Rect rect) {
      // Since we offset so that any internal shadow padding isn't shown, we need to make
      // sure that the shadow isn't used for any dodge inset calculations
      final Rect shadowPadding = child.mShadowPadding;
      rect.set(child.getLeft() + shadowPadding.left,
      child.getTop() + shadowPadding.top,
      child.getRight() - shadowPadding.right,
      child.getBottom() - shadowPadding.bottom);
      return true;
      }


      As you can see getInsetDodgeRect was returning true and by some reason rect was not intersecting. This causes the problem.



      The workaround.



      I could fix it just extending the behavior and overwriting the method getInsetDodgeRect to return false;



      public class ScrollAwareFABBehavior extends FloatingActionButton.Behavior {
      ...
      @Override
      public boolean getInsetDodgeRect(@NonNull CoordinatorLayout parent, @NonNull FloatingActionButton child, @NonNull Rect rect) {
      super.getInsetDodgeRect(parent, child, rect);
      return false;
      }
      ...






      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Oct 5 '16 at 13:17









      jDurjDur

      1,28179




      1,28179













      • How do you set the ScrollAwareFABBehavior to the FloatingActionButton?

        – Bernd Kampl
        Nov 16 '16 at 10:01






      • 1





        <android.support.design.widget.FloatingActionButton app:layout_behavior="com.your.package.ScrollAwareFABBehavior"/>

        – jDur
        Nov 16 '16 at 10:57













      • Using it like this results in a crash on startup with InflateException: Binary XML file: Could not inflate Behavior subclass com.mypackage.etc.ScrollAwareFABBehavior

        – Bernd Kampl
        Nov 23 '16 at 12:46













      • I was missing the Constructors, having the following now works: pastebin.com/UAzGYyYE

        – Bernd Kampl
        Nov 23 '16 at 13:22













      • As of appcompat support version 25.0.1 the bug is still present. The fix you provided works quite well. No need to use an old library. Thank you!

        – Grux
        Dec 1 '16 at 19:28



















      • How do you set the ScrollAwareFABBehavior to the FloatingActionButton?

        – Bernd Kampl
        Nov 16 '16 at 10:01






      • 1





        <android.support.design.widget.FloatingActionButton app:layout_behavior="com.your.package.ScrollAwareFABBehavior"/>

        – jDur
        Nov 16 '16 at 10:57













      • Using it like this results in a crash on startup with InflateException: Binary XML file: Could not inflate Behavior subclass com.mypackage.etc.ScrollAwareFABBehavior

        – Bernd Kampl
        Nov 23 '16 at 12:46













      • I was missing the Constructors, having the following now works: pastebin.com/UAzGYyYE

        – Bernd Kampl
        Nov 23 '16 at 13:22













      • As of appcompat support version 25.0.1 the bug is still present. The fix you provided works quite well. No need to use an old library. Thank you!

        – Grux
        Dec 1 '16 at 19:28

















      How do you set the ScrollAwareFABBehavior to the FloatingActionButton?

      – Bernd Kampl
      Nov 16 '16 at 10:01





      How do you set the ScrollAwareFABBehavior to the FloatingActionButton?

      – Bernd Kampl
      Nov 16 '16 at 10:01




      1




      1





      <android.support.design.widget.FloatingActionButton app:layout_behavior="com.your.package.ScrollAwareFABBehavior"/>

      – jDur
      Nov 16 '16 at 10:57







      <android.support.design.widget.FloatingActionButton app:layout_behavior="com.your.package.ScrollAwareFABBehavior"/>

      – jDur
      Nov 16 '16 at 10:57















      Using it like this results in a crash on startup with InflateException: Binary XML file: Could not inflate Behavior subclass com.mypackage.etc.ScrollAwareFABBehavior

      – Bernd Kampl
      Nov 23 '16 at 12:46







      Using it like this results in a crash on startup with InflateException: Binary XML file: Could not inflate Behavior subclass com.mypackage.etc.ScrollAwareFABBehavior

      – Bernd Kampl
      Nov 23 '16 at 12:46















      I was missing the Constructors, having the following now works: pastebin.com/UAzGYyYE

      – Bernd Kampl
      Nov 23 '16 at 13:22







      I was missing the Constructors, having the following now works: pastebin.com/UAzGYyYE

      – Bernd Kampl
      Nov 23 '16 at 13:22















      As of appcompat support version 25.0.1 the bug is still present. The fix you provided works quite well. No need to use an old library. Thank you!

      – Grux
      Dec 1 '16 at 19:28





      As of appcompat support version 25.0.1 the bug is still present. The fix you provided works quite well. No need to use an old library. Thank you!

      – Grux
      Dec 1 '16 at 19:28











      7














      It's a bug introduced in support library 24.2.1, see here.



      Known workarounds:




      • Downgrade to a different support library version






      share|improve this answer
























      • User Chisko already provided this information, take a look at the first comment on the question.

        – goetzc
        Sep 22 '16 at 15:49











      • @goetzc Providing it as an answer is better. You can now mark this correct so it shows up as the best way to handle this issue.

        – Jared Burrows
        Oct 26 '16 at 16:29
















      7














      It's a bug introduced in support library 24.2.1, see here.



      Known workarounds:




      • Downgrade to a different support library version






      share|improve this answer
























      • User Chisko already provided this information, take a look at the first comment on the question.

        – goetzc
        Sep 22 '16 at 15:49











      • @goetzc Providing it as an answer is better. You can now mark this correct so it shows up as the best way to handle this issue.

        – Jared Burrows
        Oct 26 '16 at 16:29














      7












      7








      7







      It's a bug introduced in support library 24.2.1, see here.



      Known workarounds:




      • Downgrade to a different support library version






      share|improve this answer













      It's a bug introduced in support library 24.2.1, see here.



      Known workarounds:




      • Downgrade to a different support library version







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Sep 22 '16 at 9:27









      darkendarken

      555718




      555718













      • User Chisko already provided this information, take a look at the first comment on the question.

        – goetzc
        Sep 22 '16 at 15:49











      • @goetzc Providing it as an answer is better. You can now mark this correct so it shows up as the best way to handle this issue.

        – Jared Burrows
        Oct 26 '16 at 16:29



















      • User Chisko already provided this information, take a look at the first comment on the question.

        – goetzc
        Sep 22 '16 at 15:49











      • @goetzc Providing it as an answer is better. You can now mark this correct so it shows up as the best way to handle this issue.

        – Jared Burrows
        Oct 26 '16 at 16:29

















      User Chisko already provided this information, take a look at the first comment on the question.

      – goetzc
      Sep 22 '16 at 15:49





      User Chisko already provided this information, take a look at the first comment on the question.

      – goetzc
      Sep 22 '16 at 15:49













      @goetzc Providing it as an answer is better. You can now mark this correct so it shows up as the best way to handle this issue.

      – Jared Burrows
      Oct 26 '16 at 16:29





      @goetzc Providing it as an answer is better. You can now mark this correct so it shows up as the best way to handle this issue.

      – Jared Burrows
      Oct 26 '16 at 16:29











      3














      The bug have been fixed in 25.1.0






      share|improve this answer
























      • I am still facing it in 25.1.0. Any solution yet ?

        – SimpleCoder
        Feb 14 '17 at 2:39


















      3














      The bug have been fixed in 25.1.0






      share|improve this answer
























      • I am still facing it in 25.1.0. Any solution yet ?

        – SimpleCoder
        Feb 14 '17 at 2:39
















      3












      3








      3







      The bug have been fixed in 25.1.0






      share|improve this answer













      The bug have been fixed in 25.1.0







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Jan 9 '17 at 17:19









      AmmarAmmar

      1,078915




      1,078915













      • I am still facing it in 25.1.0. Any solution yet ?

        – SimpleCoder
        Feb 14 '17 at 2:39





















      • I am still facing it in 25.1.0. Any solution yet ?

        – SimpleCoder
        Feb 14 '17 at 2:39



















      I am still facing it in 25.1.0. Any solution yet ?

      – SimpleCoder
      Feb 14 '17 at 2:39







      I am still facing it in 25.1.0. Any solution yet ?

      – SimpleCoder
      Feb 14 '17 at 2:39













      1














      The problem is present when used a layout based on a old version appcompat, look the layout xml file and edit it. Erase tools:context atribut and the problem is solved.






      share|improve this answer




























        1














        The problem is present when used a layout based on a old version appcompat, look the layout xml file and edit it. Erase tools:context atribut and the problem is solved.






        share|improve this answer


























          1












          1








          1







          The problem is present when used a layout based on a old version appcompat, look the layout xml file and edit it. Erase tools:context atribut and the problem is solved.






          share|improve this answer













          The problem is present when used a layout based on a old version appcompat, look the layout xml file and edit it. Erase tools:context atribut and the problem is solved.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 31 '16 at 18:46









          aferreraferrer

          111




          111























              0














              i was getting the same error but some how uninstalling the app and re running it again helped solve it






              share|improve this answer




























                0














                i was getting the same error but some how uninstalling the app and re running it again helped solve it






                share|improve this answer


























                  0












                  0








                  0







                  i was getting the same error but some how uninstalling the app and re running it again helped solve it






                  share|improve this answer













                  i was getting the same error but some how uninstalling the app and re running it again helped solve it







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 27 '17 at 8:15









                  Ismael ozilIsmael ozil

                  36925




                  36925






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f39536519%2fjava-lang-illegalargumentexception-rect-should-intersect-with-childs-bounds%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Xamarin.iOS Cant Deploy on Iphone

                      Glorious Revolution

                      Dulmage-Mendelsohn matrix decomposition in Python