Android跑马灯纯代码实现

  • Post author:
  • Post category:其他


public class main extends Activity {


/** Called when the activity is first created. */

@Override

public void onCreate(Bundle savedInstanceState) {


super.onCreate(savedInstanceState);

//        setContentView(R.layout.main);

TextView v=new TextView(this);

v.setFocusable(true);

v.setText(“哇哈哈哇哈哈哇哈哈哇哈哈哇哈哈wahahawahhahwahhahahwahahhahahawhahhaha……”);

v.setTransformationMethod(SingleLineTransformationMethod.getInstance());

v.setSingleLine(true);

v.setEllipsize(TextUtils.TruncateAt.MARQUEE);

v.setMarqueeRepeatLimit(3);

v.requestFocus();

this.setContentView(v);

}

}



版权声明:本文为dingran999999999原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。