TextView
android:maxLines="1" //最多一行
android:maxLines="1" android:ellipsize="end" //一行超出出现省略号
//一行跑马灯
android:layout_width="300dp"
android:layout_height="wrap_content"
android:text="红尘紫红尘紫红尘红尘紫红尘紫红尘尘红尘红尘紫红尘紫红尘尘红尘尘红尘"
android:textColor="#000"
android:textSize="24sp"
android:background="#ff00ff00"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:textIsSelectable="true"
android:singleLine="true"
private TextView tv_4;
tv_4= this.<TextView>findViewById(R.id.tv_5);
tv_4.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);//中划线
tv_4.getPaint().setAntiAlias(true);//去除锯齿
tv_6= this.<TextView>findViewById(R.id.tv_6);
tv_6.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);//下划线
tv_7= this.<TextView>findViewById(R.id.tv_7);
tv_7.setText("红尘紫陌");//没有下划线
tv_8= this.<TextView>findViewById(R.id.tv_8);
tv_8.setText(Html.fromHtml("<u>红尘紫陌</u>",1));//有下划线
//监听点击事件,跳转到另一个Activity
mBtnText= this.<Button>findViewById(R.id.btn1);
mBtnText.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
/*跳转到text演示界面*/
Intent intent=new Intent(MainActivity.this,TextActivity.class);
startActivity(intent);
}
});