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

                 }

         }

    }

}

 
posted on 2012-12-20 09:58  洛易  阅读(5112)  评论(0编辑  收藏  举报