我正在尝试将"@"设置为TextView
中的文本,但由于@
是参考键,因此不允许我将其设置为文本。
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@" />
你需要
像这样转义它,\@
这样的资源<string name="my_string">\@my_string</string
和双引号之间的@
使用 @
获取所需的字符。
string str = "≤ ≥";
textView.setText(Html.fromHtml(str));
或者你也可以使用这个
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TableRow>
<TextView
android:layout_column="1"
android:text="•"></TextView>
<TextView
android:layout_column="2"
android:layout_width="wrap_content"
android:text="First line"></TextView>
</TableRow>
<TableRow>
<TextView
android:layout_column="1"
android:text="•"></TextView>
<TextView
android:layout_column="2"
android:layout_width="wrap_content"
android:text="Second line"></TextView>
</TableRow>