TextView

android textview 添加下划线 中划线 删除线

tv=(TextView)findViewById(R.id.tvId);
  tv.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG); //删除线

//Paint.UNDERLINE_TEXT_FLAG 下划线 可以测试其他的自己

 

从数组中删除元素的方法(TextView.class 4945行),用了修改Drawable的state。

 

            final int length = drawableState.length;

 

            for (int i = 0; i < length; i++) {

 

                if (drawableState[i] == R.attr.state_pressed) {

 

                    final int[] nonPressedState = new int[length - 1];

 

                    System.arraycopy(drawableState, 0, nonPressedState, 0, i);

 

                    System.arraycopy(drawableState, i + 1, nonPressedState, i, length - i - 1);

 

                    return nonPressedState;

 

                }

 

            }

 

posted @ 2014-02-20 17:58  huiyh  阅读(233)  评论(0编辑  收藏  举报