如何在Android Studio中为文本加下划线?

如何在Android Studio中为文本加下划线?,android,Android,到处找,找不到解决办法。设置粗体或斜体很容易,为什么设置下划线不那么容易 以下是我的相关代码: <LinearLayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/forgotpasswordHolder"

到处找,找不到解决办法。设置粗体或斜体很容易,为什么设置下划线不那么容易

以下是我的相关代码:

   <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/forgotpasswordHolder"
        android:layout_marginTop="10dp">

        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="Forgot your password?"
            android:id="@+id/labForgotpassword"
            android:textColor="#6BB08C"
            android:layout_weight="1"
            android:textStyle="bold|italic"
            android:layout_gravity="left"
            android:paddingLeft="20dp"
            android:textIsSelectable="true"
            android:singleLine="false" />

        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="Not a member?"
            android:id="@+id/signup"
            android:textColor="#6BB08C"
            android:layout_weight="1"
            android:textStyle="bold|italic"
            android:singleLine="false"
            android:layout_gravity="right"
            android:gravity="right"
            android:paddingRight="20dp"
            android:textIsSelectable="true" />
    </LinearLayout>

我有两个“忘记密码”和一个“不是会员?”按钮,如果我能在文本下面划线,我会很高兴


提前感谢!

使用带有
标记的字符串资源,如下所示

android:text="@string/forgotPassword"
然后在strings.xml中,创建一个字符串

<string name="forgotPassword"><u>Forgot your password?</u></string>
忘记密码了吗?

只需在
文本视图下方创建一个
视图

例如


所以我试过了,但它没有下划线。我甚至还玩过它的颜色,将它改为android:textColor=“#FFFFFF”,它将它改为白色,但仍然没有下划线。它不会显示在编辑器中,但一旦你运行应用程序,它应该可以工作