博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Android异常(一)
阅读量:7116 次
发布时间:2019-06-28

本文共 2517 字,大约阅读时间需要 8 分钟。

FATAL EXCEPTION: main

java.lang.IndexOutOfBoundsException: setSpan (5 ... 5) ends beyond length 0
at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:945)
at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:524)
at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:516)
at android.text.Selection.setSelection(Selection.java:76)
at android.widget.TextView$SelectionModifierCursorController.onTouchEvent(TextView.java:8618)
at android.widget.TextView.onTouchEvent(TextView.java:6952)
at android.view.View.dispatchTouchEvent(View.java:4040)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:944)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:944)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:944)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:944)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1817)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1232)
at android.app.Activity.dispatchTouchEvent(Activity.java:2303)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1801)
at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2233)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1917)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3768)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)

未解决

场景:

editText = (P14_ChatEditText)findViewById(R.id.p04_message_chat_send_msg);

editText.setOnTouchListener(editTextTouchListener);

OnTouchListener editTextTouchListener = new OnTouchListener(){

        @Override
        public boolean onTouch(View arg0, MotionEvent event) {

        if(event.getAction() == MotionEvent.ACTION_DOWN && dRight!=null) {

                
                rBounds = dRight.getBounds();
                final int x = (int)event.getX();
                final int y = (int)event.getY();

       //check to make sure the touch event was within the bounds of the drawable

                if(x>=(editText.getRight()-rBounds.width()) && x<=(editText.getRight()-editText.getPaddingRight())
                        && y>=editText.getPaddingTop() && y<=(editText.getHeight()-editText.getPaddingBottom()))
                {

                 }

         }

    }

}

 

转载地址:http://pgghl.baihongyu.com/

你可能感兴趣的文章
BZOJ3997:[TJOI2015]组合数学(DP,Dilworth定理)
查看>>
C# Application.DoEvents() 处理队列消息,防界面假死。
查看>>
python基础===python实现截图
查看>>
Django模型
查看>>
Quartus中代码字体大小的调整方法
查看>>
配置url防盗链、目录权限访问控制Directory、文件访问权限控制FilesMatch
查看>>
【spring boot】4.spring boot配置多环境资源文件
查看>>
关于datepicker如何获取月中日长
查看>>
神经网络练习四-ex4
查看>>
通用for_each清理容器模板函数
查看>>
MVC5发布到IIS,出现HTTP 错误 404.0 - Not Found的完美解决方法
查看>>
c# 与 java 语法异同
查看>>
cleanup failed because the file not under version control问题的解决
查看>>
html+css+js实现滑动导航条(转载)
查看>>
BZOJ 2039人员雇佣
查看>>
angular ng-repeat出来的数据 每条修改数据后返回给接口 如何取到每个对应修改的值...
查看>>
nodeJs express mongodb 建站(linux 版)
查看>>
java使用websocket,并且获取HttpSession,源码分析
查看>>
odoo开发笔记 -- 视图继承扩展
查看>>
图书管理系统——面向对象程序设计
查看>>