请教系统有没有提供相关接口。

解决方案 »

  1.   

    没有,可以自己写一个继承TextView的类
    public class BorderTextView extends TextView {
    @Override
    protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    Paint paint = new Paint();
    // 将边框设为黑色
    paint.setColor(android.graphics.Color.BLACK);
    // 画TextView的4个边
    canvas.drawLine(0, 0, this.getWidth(), 0, paint);//上
    canvas.drawLine(0, 0, 0, this.getHeight(), paint);//左
    canvas.drawLine(this.getWidth() - 1, 0, this.getWidth(), this.getHeight(), paint);//右
    canvas.drawLine(0, this.getHeight() - 1, this.getWidth(), this.getHeight(), paint);//下
    } public BorderTextView(Context context, AttributeSet attrs) {
    super(context, attrs);
    } @Override
    public void setLayoutParams(LayoutParams params) {
    if(Tab.display.getWidth() == 480) {
    params.width = (Tab.display.getWidth() - 32) / 4;
    params.height = 40;
    } else if(Tab.display.getWidth() == 240){
    params.width = (Tab.display.getWidth() - 16) / 4;
    params.height = 20;
    } else if(Tab.display.getWidth() == 640) {
    params.width = (Tab.display.getWidth() - 40) / 4;
    params.height = 45;
    }  else if(Tab.display.getWidth() == 320) {
    params.width = (Tab.display.getWidth() - 20) / 4;
    params.height = 30;
    } else {
    params.width = (Tab.display.getWidth() - 32) / 4;
    params.height = 40;
    }
    super.setLayoutParams(params);
    }
    }
      

  2.   

    Typeface这个类对你可能有帮助
      

  3.   


    光靠Typeface里的功能还实现不了
      

  4.   

    SpannableString.
    或者用背景图骗人。
      

  5.   


    请问哪个span实现了字体边框效果的?
      

  6.   

    我也是在找给TextView设置边框的方式,不能像web开发那样,直接表格布局设置边框,Android有点纠结啊