How to set Html Css text to TextView - css

I have Textview.am getting web response in the fallowing way
asdgfsagasgs
asdsa sa sad asd sada sdas
asdsad ad sad sad sad ad asdsad
asdsadsadsadsadsadsad
asdsadsadsadsaddsadsadasdasdasda sda asd
sdasdsadasdsadsadsadasdasdads
sadasdsadasddsad
asdsadsadas sad sad sad asd
sadasdas sad sadsaas sad
asdas sa sa asd sad asd asd asd asd
asddsadsadasdasd
asddsadsadasdasdasddsadsadasdasd
asddsadsadasdasd
asddsadsadasdasdas ddsadsadasdasdasddsa dsadasdasdasddsadsadasdasd
asddsadsadasdasdasddsadsadasdasd
asdasdsadsadads
how can i set to layout for apply span style color and every thing.

Try this to set textview style to bold and italic
textView.setTypeface(null, Typeface.NORMAL); // for Normal Text
textView.setTypeface(null, Typeface.BOLD); // for Bold only
textView.setTypeface(null, Typeface.ITALIC); // for Italic
textView.setTypeface(null, Typeface.BOLD_ITALIC); // for Bold and Italic
You can use this to change style of specific word as:
textview.setText(Html.fromHtml("<b>" + Year: + "</b>"+"2012,
"+"<b>" + Language: + "</b>"+":Armenian,"
"+"<b>" + Subtitles: + "</b>"+":English"));
Also You can go for SpannableString for Creating an String with different fonts,colors or style.
SpannableString(CharSequence source)

Related

How do I find out where this CSS-value comes from?

I am trying to use bootstrap tooltip for something it probably wasn't designed for, namely the possibility of showing a quite large text. I have managed to tweek it to my needs, with one exception. The width of the text box shown is way too narrow, unless i set it to a fixed width, but then it looks awfully stupid when displaying my short texts. I did override the standard max-width of 200px, but still it would not display even any wider than 120.797px
I tried to make a short simple example, and to my surprise, it works perfectly in my fiddle. with no width property set, it still grows to 800px, as set in max-width. So I tried to figure out what was different between my simple fiddle, and my larger web page. I used the google chrome dev-tools, to show me all set css properties, as I expected some unknown source to influence the width. Normally all properties set by css, are displayed with an arrow on the left side of each property, telling you exactly where, and through which file and selector statement this property is set. Here is what I found:
So, every other property gives a reference, while width remains a mysterious unknown. Notice that the font color is dark red. If this was calculated from other properties, it normally would be faded. I've tried to research what this might mean, but the official documentation leaves no clues. This page was the closest thing I could find.
How do I find out where this CSS-value comes from?
Here is a link to the fiddle. The tooltip text is a random news source from today, in norwegian. Code below, as per Stackoverflow rules:
HTML:
<span class="nav-text" data-toggle="tooltip" data-placement="right" title="" data-original-title="– Vi har nok satt oss litt i respekt i dag for de andre nasjonene. De vet nå at vi ikke er uredde og ikke er redd for å bare gå fra dem i front, sa Johannes Thingnes Bø om den solide seieren.
For da Emil Hegle Svendsen sendte Johannes Thingnes Bø ut på den siste etappen sammen med franske Antonin Guigonnat og italienske Therry Chenal var det mye som skulle gå galt for at ikke stryningen skulle sikre norsk stafettseier.
Og stryningen gikk knallhardt ut og viste konkurrentene ryggen allerede i den første motbakken.
– Jeg er ganske trygg og selvsikker når jeg går ut på siste etappe, sa ankermannen til NRK etter målgang.
En god generalprøve før OL
Det var et godt fornøyd stafettlag etter seieren. Stafetten i Ruhpolding var den store generalprøven for det som skal være det norske OL-laget i Pyeongchang i februar.
– Det var en god følelse. Jeg tar gjerne samme løpsopplegg neste gang det er stafett, sa Thingnes Bø etter seieren med et klart hint til stafetten i OL.">
Hover for tooltip
</span>
CSS:
div.tooltip{
top:0px !important;
}
div.tooltip>div.tooltip-arrow{
top:15px !important;
}
div.tooltip>div.tooltip-inner{
max-width:800px !important;
white-space: pre-wrap;
text-align: left;
}
And standard init of bootstrap tooltip, javascript:
$('[data-toggle="tooltip"]').tooltip();

How can I change the text "image 1 or ? '

How can I change the text "image 1 or 5 ' (in Dutch) or delete it. I use Lightbox-plus-jquery.js in Ligtbox2. I can’t find it in JS or CSS.
Excuse my English ...
I have solved it myself. In the rule ' AlwaysShowNavOnTouchDevices changed to Dutch: 'Figure 1% of 2% ' to ‘afbeelding 1% van 2%’.

How do I add OnClick event on part of the text?

I need to add OnClick event to part of the text in installer.
So it will be like this "bla bla bla clickable text bla bla bla".
Also this text should be with WordWrap property set to True, since I don't know exact size of it because of bunch of localizations.
I was trying to split text into 3 parts so it will be like this
"Not-clickable-text1 clickable-text2 Not-clickable-text3"
but the problem begins when text3 should go to the next line of installer. It starts from position of text3.Left property, but I need it to start on next line from text1.Left property
There is no such thing like click-able part of the text in Inno.
You really need to use 3 "texts"- either TLabel or TNewStaticText - to build the whole sentence. The middle one will have set Font property to bold, underline or blue color (depends you want the link) and Cursor set to Hand, ... and of course the OnClick event.
Both components have property AutoSize and WordWrap which you can use.
AutoSize property set to true makes your component to fit width and height to text size. Set it to True for all 3 texts.
Position texts like this:
Text1.Left := 10; // 10 is just example
Text1.Top := 10; // 10 is just example
Text2.Left := Text1.Left + Text1.Width + 3; // 3 is space
if(Text1.Height > $Constant$) then
Text3.Top := Text1.Top + Text1.Height + 3 // Create new line
else
Text3.Left := Text2.Left + Text2.Width + 3;

Break text into even line lengths with CSS only

I have a div that has text-align: center applied. It should be able to contain various text that may or may not wrap. When it wraps, I would like to have each line be roughly the same length, so it would show:
The quick brown fox jumps
over the lazy dog.
instead of:
The quick brown fox jumps over the lazy
dog.
Basically, I'm looking for a pure CSS way to automatically place the break near the center of the text.
I know there are JavaScript solutions, and I have currently implemented a server side solution, but I'm always trying to learn more CSS to make things more flexible in the future.
I'm quite sure you cannot do that with css, you can control no break points with html though.
<nobr>The quick brown fox jumps</nobr><nobr>over the lazy dog.</nobr>
Should give you the result you want.
Also you can stick between words that you don't want to wrap, for instance: The quick brown fox jump over the lazy dog. would give you the same result.
Put the pieces you don't want to break in span tags that forbid wrapping:
<span style="white-space: nowrap">The quick brown fox jumps</span>
<span style="white-space: nowrap">over the lazy dog.</span>
(I know this is old, but I just went looking for this.)
function run() {
const str = "The quick brown fox jumps over the lazy dog."
const arr = str.split(" ")
const num = Math.floor(arr.length / 2)
let res = ""
arr.map((item, i) => {
res += item + " "
if (num === i) res += "\n"
})
console.log(res)
}
run()
What if you reduce the width of your div ? Otherwise I'm not sure you can do it with CSS only

Blinking and coloring asp.net label control

I have a asp.net label control on my webform:
for this label I am setting the text property from code behind:
lblOne.Text = "Number of student is: 86 and Number of teacher is: 7";
Now I want to do 2 things:
Blinking the label.
Coloring: "Number of student is:" -
RED Color "86" :- BLUE
"and Number of teacher is:" - RED & 7:- BLUE
How can I do these things?
Are you really sure you want that text to blink, the <blink> tag disappeared for a reason :-)
You could set a ForeColor for a label, but only for the complete Label. So what you could do is split that text into two labels, one blue and one red.
A different solution would be to use a Literal and set the html yourself:
Literal1.Text = String.Format("Number of student is: <span style='color:red'>{0}</style> and Number of teacher is: <span style='color:blue'>{1}</span>", student, teacher);

Resources