Tôi có liên kết trong TextView tôi:Tại sao liên kết không hoạt động trong chế độ xem văn bản?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
...
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="all"
android:linksClickable="true"
android:text="@string/app_description" />
</RelativeLayout>
Liên kết là một phần của tài nguyên:
<?xml version="1.0" encoding="utf-8"?>
<resources>
...
<string name="app_description">Some text with the <a href="http://www.example.com">link</a>.</string>
</resources>
Bằng cách nào đó liên kết không hoạt động. Điều gì có thể là một lý do? Nó được hiển thị giống như một liên kết. Nhưng nhấp chuột không mở trình duyệt.
Mã lớp:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Bạn có thử với android: nhấp được = "true"? –
Xem liệu [Làm cách nào để tạo liên kết trong TextView có thể nhấp] (http://stackoverflow.com/questions/2734270/how-do-i-make-links-in-a-textview-clickable) hoặc [Liên kết trong TextView ] (http://stackoverflow.com/questions/4790746/links-in-textview) câu hỏi sẽ giúp ích. –
Hãy thử cách này: android: autoLink = "web" –