如何添加图片,中间链接string.xml

How to add images,links in between string.xml

我向 Project.So 添加了滚动 activity(textscoll) 我想向 activity 添加大文本,并在 text.So 我添加的大 text.So 之间添加几张图片string.xml 中的字符串文件并在滚动 activity(content_textscoll.xml)...

中调用它

我的字符串文件

<string name="string_text_file">This is huge text...</string>

我的content_textscoll.xml

<TextView
            android:layout_width="wrap_content"
            android:textColor="#000000"
            android:textSize="20dp"
            android:lineSpacingMultiplier="1.3"
            android:layout_height="wrap_content"
            android:layout_margin="@dimen/text_margin"
            android:text="@string/string_text_file" />

我的问题是, *我想在上面 text.How 之间添加几张图片来解决这个问题....? 我可以将图像添加到 drawble folder.How 来调用它们吗? *如何添加 html 链接或其他 activity 链接

制作网页视图:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="abhiandroid.com.htmlexample.MainActivity">
<WebView
    android:id="@+id/simpleWebView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_margin="20dp" />
</RelativeLayout>

创建 assest 文件夹(如果不存在)并在其中创建新的 html 文件并使用您想要的任何名称,然后像这样将您的文本和图像放在那里:

<p>in this tag (p tag) put your text </p>
<img>in this tag (img tag) put your images </img>

在你的activity中做这样的事情:

 WebView webView;

public String fileName = "yourAssestFileName.html";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    // init webView
    webView = (WebView) findViewById(R.id.simpleWebView);
    // displaying content in WebView from html file that stored in assets folder
    webView.getSettings().setJavaScriptEnabled(true);
    webView.loadUrl("file:///android_asset/" + fileName);
}