场景:Fragment onCreateView中
异常如下
java.lang.StackOverflowError: stack size 8MB
at android.widget.TextView.jumpDrawablesToCurrentState(TextView.java:6623)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:7058)
代码如下
错误代码
inflater.inflate(R.layout.fragment_demo1, container)
正确代码
inflater.inflate(R.layout.fragment_demo1, container,false)
原因不明,稍后整理,哈哈哈哈哈哈哈哈,以上