我知道這似乎是一個愚蠢的問題,應該已經問過,但我沒有找到問題的簡單要求和回答。如何在textview中設置帶有口音的文本?
我的表現在第一行:
<?xml version="1.0" encoding="utf-8"?>
如果我有XML佈局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView
android:id="@+id/text_target"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:color/holo_blue_light"
android:layout_margin="10dp"
android:text="" />
</LinearLayout>
和Java代碼:
TextView question = (TextView) findViewById(R.id.text_target);
String text = "Lorsqu'ils sont utilisés, les accents peuvent être un plus à apporter à leur texte.";
question.setText(question.setText(Html.fromHtml(text)));
它顯示:
你知道如何顯示口音?
<?xml version =「1.0」encoding =「utf-8」?>這個也在你的xml中 –
你試過用'Html.fromHtml'嗎? –
@ρяσѕρєяK是的,我試過 – lambdaDev