Android 如何在string.xml之间添加图像和链接
我在我的项目中添加了滚动活动(textscoll)。因此我想在该活动中添加大量文本,并在这些大量文本之间添加一些图像。因此,我在string.xml中添加了字符串文件,并在滚动活动(content_textscoll.xml)中调用它 我的字符串文件Android 如何在string.xml之间添加图像和链接,android,xml,image,scroll,textview,Android,Xml,Image,Scroll,Textview,我在我的项目中添加了滚动活动(textscoll)。因此我想在该活动中添加大量文本,并在这些大量文本之间添加一些图像。因此,我在string.xml中添加了字符串文件,并在滚动活动(content_textscoll.xml)中调用它 我的字符串文件 <string name="string_text_file">This is huge text...</string> 这是一个巨大的文本。。。 我的内容\u textscoll.xml <TextView
<string name="string_text_file">This is huge text...</string>
这是一个巨大的文本。。。
我的内容\u 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" />
我的问题是,
*我想在上面的文本之间添加几个图像。如何解决这个问题。。。。?
我可以将图像添加到drawble文件夹。如何调用它们?
*如何添加html链接或其他活动链接创建web视图:
<?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>
跟着这个,谢谢。希望它能帮助我
<p>in this tag (p tag) put your text </p>
<img>in this tag (img tag) put your images </img>
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);
}