
使用google-api-translate-java, 首先從網頁下載jar檔案到你的電腦上, 然後添加External JARs, 從Eclipse, 在你的project上右擊選擇Properties>Java Build Path, 選擇libraries標籤, 再選擇Add External JARs以添加剛才下載的jar檔案.
相關文章: 在Android應用程序內使用Google Translate API, google-api-translate-java
http://androidbiancheng.blogspot.com/
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="jave_format_string">Hello %1$s, it's %2$s.</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/mystring"
/>
</LinearLayout>
package com.AndroidString;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class AndroidString extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView myString = (TextView)findViewById(R.id.mystring);
myString.setText(String.format(getString(R.string.jave_format_string), "Android", "Java Format String"));
}
}
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="simple_string">simple string</string>
<string name="formatted_string">It's <b><i>BOLD string</i></b>!</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/simple_string"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/formatted_string"
/>
</LinearLayout>