自动链接删除文本的下划线

时间:2018-06-10 20:28:50

标签: android

使用android:autolink属性时遇到问题。其中一个字符串不显示为链接,而另一个字符串显示。我没有做任何不同的事情,他们只是不同的网址相同的模式。

我的xml:

            ...
           <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="horizontal">

                <CheckBox
                    android:id="@+id/terms_check"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:layout_weight="1" />

                <TextView
                    android:id="@+id/terms_text"
                    android:layout_width="match_parent"
                    android:layout_height="20dp"
                    android:layout_marginBottom="10dp"
                    android:layout_marginTop="10dp"
                    android:text="@string/terms_conditions"
                    android:onClick="goToTerms"
                    android:autoLink="web"
                    />

            </LinearLayout>

            <TextView
                android:id="@+id/privacy_text"
                android:layout_width="match_parent"
                android:layout_height="20dp"
                android:layout_marginBottom="50dp"
                android:layout_marginLeft="40dp"
                android:layout_marginStart="30dp"
                android:text="@string/privacy"
                android:onClick="goToPrivacy"
                android:autoLink="web"
                />
                ...

目前,第二个textview在app中打开链接并显示为链接,而第一个文本视图不会将文本显示为链接,而是显示为普通文本(无下划线)。虽然,它仍然可以点击并打开应用程序中的链接。

当我删除android:autolink时,它会更改为链接,但当我将其添加到代码中时,它会显示为普通文本。我希望第一个TextView显示为链接而不是文本。

我不确定问题是什么。

0 个答案:

没有答案