zoukankan      html  css  js  c++  java
  • Android异常(一)

    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()))
                    {

                     }

             }

        }

    }

     
  • 相关阅读:
    Java实现 LeetCode 324 摆动排序 II
    Java实现 LeetCode 324 摆动排序 II
    ubuntu 10.10配置NFS网络共享步骤
    让C/C++程序一次编译可以发布到多版本Linux之上
    linux下so动态库一些不为人知的秘密(中二)
    linux下so动态库一些不为人知的秘密(中)
    linux下so动态库一些不为人知的秘密(上)
    tftp使用方法
    Linux操作系统下三种配置环境变量的方法
    Linux中环境变量文件及配置
  • 原文地址:https://www.cnblogs.com/royi123/p/2825914.html
Copyright © 2011-2022 走看看