bold

Problems changing the style of certain items in a ListView

最后都变了- 提交于 2019-12-11 10:09:48
问题 I have a ListView of TextViews and to highlight one of these, I want to make the TextView bold . This only works if I don't scroll the ListView. After I scroll, the boldness changes to a different position. Does anyone know why, or how I can solve this problem? 回答1: It may be problem with ListView, because listview reuses view items (and puts content inside them), if you are using convertView feature. It's hard to say without seeing your code where it goes wrong. You could try using Html

QTableWidget: different styles in *one* QTableWidgetItem?

人盡茶涼 提交于 2019-12-11 04:32:09
问题 Is it possible to have a two-line element in a cell (QTableWidgetItem) of a QTableWidget with different styles per line? I want to have the first line bold and the second line not bold. Or can I add two QTableWidgetItems in one cell? Do a cellspan somehow? Cheers Matthias 回答1: Simple way : Checkout the setCellWidget method of QTableWidget. If you replace the default widget with QTextEdit, you can get rich text formatting capability. Better way : Use a custom QStyledItemDelegate. You can see

Highlight and Bold text in JTextPane

﹥>﹥吖頭↗ 提交于 2019-12-11 00:54:28
问题 I am trying to add some code to myHighlighter class so that i can highlight and turn BOLD the part of the text i want.My first try was not successful.. Highlighter.HighlightPainter myHighlightPainter = new MyHighlightPainter(Color.red,Font.BOLD); class MyHighlightPainter extends DefaultHighlighter.DefaultHighlightPainter { public MyHighlightPainter(Color color, int Font) { super(color); } Also i am trying to avoid Graphics... 回答1: Have you tried setting the text to HTML? I believe the

Bold labels in MFC

独自空忆成欢 提交于 2019-12-10 21:54:37
问题 I want to create labels in MFC (Static text) that have both bold and non-bold text. Something like this: "I would like my label to look like this, for example" Any thoughts of how to do this? I know that I can change the font of the entire label and have it either bold or not, but is there any way of merging more than one style, or maybe give an html-like label? 回答1: Instead of a static control, use a RichEdit control containing appropriately marked up text. 来源: https://stackoverflow.com

Need to make selected text as bold/italic/underline using javascript, and also save & retrieve the same using c#

你离开我真会死。 提交于 2019-12-07 05:36:22
问题 I need to make selected text of textbox bold/italic/underline using javascript. For that i am using the following code. <img src="~/images/Bold" alt="Bold" onclick="changeFont('TextBox1','b');" /> <img src="~/images/Italic" alt="Italic" onclick="changeFont('TextBox1','i');" /> <img src="~/images/Underline" alt="Underline" onclick="changeFont('TextBox1','u');" /> <script type="text/javascript" language="javascript"> function changeFont(txt, change) { if (change == 'b') { if (document

String array text formatting

流过昼夜 提交于 2019-12-06 07:16:31
问题 I have this String: String[] text = {"Address 1: Street nr.45 ", "Address 2: Street nr.67", "Address 3: Street nr. 56 \n Phone number: 000000000"}; Which gets used later by: ((TextView)findViewById(R.id.adresa)).setText(text[newSelectedAddress]); when selecting an item from a spinner. How can I add formatting to the text inside the string?? I want Address to be with bold, Street nr. with Italic 回答1: You have to use Spannables. Although creating them is a bit wordy and seems complex, it isn't

Android Textview Italic and wrap_contents

亡梦爱人 提交于 2019-12-05 01:46:04
I am using 3 italic textviews with different colors <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:id="@+id/submittedBy" android:paddingTop="10dip"> <ImageView android:id="@+id/subByImg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="left" android:layout_gravity="bottom" android:src="@drawable/submitted_by_arrow"/> <TextView android:id="@+id/submitLabel" android:layout_width="wrap_content" android:layout_height=

String array text formatting

Deadly 提交于 2019-12-04 16:27:07
I have this String: String[] text = {"Address 1: Street nr.45 ", "Address 2: Street nr.67", "Address 3: Street nr. 56 \n Phone number: 000000000"}; Which gets used later by: ((TextView)findViewById(R.id.adresa)).setText(text[newSelectedAddress]); when selecting an item from a spinner. How can I add formatting to the text inside the string?? I want Address to be with bold, Street nr. with Italic You have to use Spannable s. Although creating them is a bit wordy and seems complex, it isn't rocket science. An example: String source = "This is example text"; SpannedString out = new SpannedString

Convert uppercase matches to bold using regex

时间秒杀一切 提交于 2019-12-02 13:01:15
问题 i need to find all uppercase words in a string and set it bold $_POST['descricao'] = "UPPERCASE test WORD" $_POST['descricao'] = preg_replace("\b[A-Z]{2,}\b", "<b>\\1</b>", $_POST['descricao']); it should return: <b>UPPERCASE</b> test <b>WORD</b> 回答1: You need to capture the group and enclose the pattern: preg_replace("/\b([A-Z]{2,})\b/", "<b>\\1</b>", $_POST['descricao']); 回答2: Use this: $_POST['descricao'] = "UPPERCASE test WORD" $_POST['descricao'] = preg_replace("/\b([A-Z]{2,})\b/", "<b>

a:active only briefly works (during mouse click)

大城市里の小女人 提交于 2019-12-02 07:13:53
问题 For some reason, I made it so my text (a) that is active is bolded, but it is only active when it is clicked with my mouse, when it is released from the click, it turns off and the text goes back to it's normal state. Why is this? If you got to MSN, look at the text above their search bar. When you click on it, it bolds and turns orange. Without leaving the page. That's what I am trying to do. HTML: <div id="searchtopics"> <ul> <li><a href="#">Web</a> </li> <li><a href="#">MSN</a> </li> <li>