Home » Java » java – Android HTML.fromHTML get output in one line – Stack Overflow

java – Android HTML.fromHTML get output in one line – Stack Overflow

Posted by: admin February 20, 2020 Leave a comment

Questions:

I am setting a textview as HTML retrieved from Firebase database. When I am setting the question the I am adding another value called qid to the textview. But the output comes in 2 lines.

(2). 
What is 2+2

The above is what I am getting and the below is what I want to get.

(2). What is 2+2

The below is how I have approached to this.

txtQuiz.setText(Html.fromHtml("(" + dataSnapshot.child(String.valueOf(question)).child("qid").getValue().toString() + "). </p> " + dataSnapshot.child(String.valueOf(question)).child("question").getValue().toString()));

How do I get the output in one line.

Also for reference the question “What is 2+2” is wrapped in HTML paragraph tag since I am using TinyMCE HTML editor to input questions. When I delete the Paragraph tag from firebase it works fine (guessing that Paragaph display:block is what causes the problem. When I tried to give paragraph display:inline, it doesn’t work still.

Answers: