赞
踩
Android : textview text bold, underlined, slanted
TextView textView = findViewById(R.id.text_view);
textView.setTypeface(null, Typeface.BOLD);
TextView textView = findViewById(R.id.textView);
// Set the text to be bold, underlined, and slanted
textView.setTypeface(textView.getTypeface(), Typeface.BOLD_ITALIC | Typeface.UNDERLINE);
// Alternatively, you can set each style separately
// textView.setTypeface(textView.getTypeface(), Typeface.BOLD);
// textView.setPaintFlags(textView.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
// textView.setTypeface(Typeface.create(textView.getTypeface(), Typeface.ITALIC));
// Get the TextView instance
TextView textView = findViewById(R.id.textView);
// Add underline
textView.setPaintFlags(textView.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
// Remove underline
textView.setPaintFlags(textView.getPaintFlags() & (~Paint.UNDERLINE_TEXT_FLAG));
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。