【发布时间】:2018-03-23 01:13:05
【问题描述】:
我有Xamarin.Android project 并使用MVVMCross。我需要在.axml 布局中添加一些下划线文本。
我找到了一些方法来做到这一点,但它对我不起作用。
我有这个布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
layout="@layout/toolbar" />
<TextView
android:id="@+id/TextView01"
android:textSize="16sp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_below="@+id/toolbar"
local:MvxBind="Text Strings[Text01]" />
<TextView
android:id="@+id/textLink"
android:textSize="13sp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:textColor="#1565C0"
android:layout_below="@id/TextView01"
local:MvxBind="Text Strings[textLink]; Click MyCommand" />
</RelativeLayout>
-
字符串。
<string name="your_string"><u>Underlined text</u></string>
我不能使用这种方式,因为我使用两种语言,并且我有文件夹 Locales 和两个 .txt 文件。所以项目不会从strings.xml获取字符串
-
油漆。
TextView MyLink = FindViewById<TextView>(Resource.Id.MyLink); MyLink.PaintFlags = (MyLink.PaintFlags | Android.Graphics.PaintFlags.UnderlineText); -
来自Html。
txtView.setText(Html.fromHtml("<u>underlined</u> text"));
对我不起作用,除了我看到绿色下划线并评论此决定已被弃用。
如何将我的TextView 标记为下划线?
【问题讨论】:
标签: android xamarin.android textview mvvmcross