如何在android中更改超链接的颜色

sup*_*per 5 android android-layout

为了在我的Android应用程序的页面上显示超链接,我这样做:

MyProgram.java

link1.setText(Html.fromHtml(linkText1));
        link1.setMovementMethod(LinkMovementMethod.getInstance());


        TextView link = (TextView) findViewById(R.id.textView2);
        String linkText = "Visit the <a href='http://www.mydomain.com'>My Website</a> web page.";
        link.setText(Html.fromHtml(linkText));
        link.setMovementMethod(LinkMovementMethod.getInstance());
        // Place email address
        TextView email = (TextView) findViewById(R.id.textView3);
        String emailText = "Contact Me: <a href=\"mailto:myname@mydomain.com\">myname@mydomain.com</a>";
        email.setText(Html.fromHtml(emailText));
        email.setMovementMethod(LinkMovementMethod.getInstance());
Run Code Online (Sandbox Code Playgroud)

myprogram.XML

<TextView android:text="TextView" android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000000" android:textSize="30dp"></TextView>
        <View
        android:layout_width="fill_parent"
        android:layout_height="30dp">
    </View>
        <TextView android:text="TextView" android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000000" android:textSize="30dp"></TextView>
Run Code Online (Sandbox Code Playgroud)

如果您在我的XML中看到,我已尝试将颜色更改为黑色(android:textColor ="#000000"),但我仍未看到超链接中的任何更改.它仍然是默认颜色,即蓝色

任何帮助?

ale*_*dev 23

你应该使用另一个属性:

android:textColorLink="#000000"
Run Code Online (Sandbox Code Playgroud)