<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/tvQuestion1"
android:text=" Q1: What causes relapse?"
android:visibility="visible"
android:textStyle="bold"
android:fontFamily="sans-serif"
android:textColor="#00695C"
android:textSize="24sp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/tvAnswer1"
android:paddingLeft="12dp"
android:textSize="20sp"
android:maxLines = "15"
android:scrollbars = "vertical"
android:lineSpacingExtra="10dp"
android:textStyle="italic"
android:text="Various “triggers” can put people at risk of relapsing into old patterns of substance use.
Causes of relapse can differ for each person.
Some common ones include:
• negative emotional states (such as anger, sadness, trauma or stress)
• physical discomfort (such as withdrawal symptoms or physical pain)
• positive emotional states (wanting to feel even better)
• testing personal control (“I can have just one pill”)
• strong temptations or urges (cravings to use)
• conflict with others (such as an argument with a spouse or partner)
• social pressures to use (situations where it seems as though everyone else is using drugs)
• good times with others (such as having fun with friends or family)
"
android:visibility="gone"/>
答案 0 :(得分:1)
嘿,对于要点,你可以使用它:
textView1.setText("\u2022" + " " +YOUR TEXT);
\ u2022 会给你一个要点,然后使用 \ n 来打破这一行。 祝你好运:D
答案 1 :(得分:1)
试试这段代码:
XML中的字符串
enter code he<resources>
<string name="app_name">TestProject2</string>
<string name="html">
<![CDATA[
<h1>Main Title</h1>
<h2>A sub-title</h2>
<p>This is some html. Look, here\'s an <u>underline</u>.</p>
<p>Look, this is <em>emphasized.</em> And here\'s some <b>bold</b>.</p>
<p>This is a UL list:
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
</ul>
<p>This is an OL list:
<ol>
<li>One</li>
<li>Two</li>
<li>Three</li>
</ol>
]]>
</string>
</resources>re
如果您需要以点为单位显示数据,请在字符串中添加数据这是它可以帮助您的简短示例
xml布局
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:orientation="vertical"
android:gravity="top|fill_vertical">
<TextView
android:id="@+id/textView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
<!--
<WebView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/webView"
android:layout_below="@+id/helloWorld"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
/>
-->
</LinearLayout>
<强> MainActivity.java 强>
package com.alvinalexander.testproject2;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.text.Html;
import android.text.Spanned;
import android.widget.TextView;
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// get our html content
String htmlAsString = getString(R.string.html); // used by WebView
Spanned htmlAsSpanned = Html.fromHtml(htmlAsString); // used by TextView
// set the html content on a TextView
TextView textView = (TextView) findViewById(R.id.textView);
textView.setText(htmlAsSpanned);
// WebView webView = (WebView) findViewById(R.id.webView);
// webView.loadDataWithBaseURL(null, htmlAsString, "text/html", "utf-8", null);
}
}
这个例子看起来像:
请尝试一下,我觉得它可以帮到你。