Ich habe einen Android-Chat mit der Verwendung von Listenansicht und Firebase gemacht. Ich möchte Links in Chat-Nachrichten aktiv machen. Links sind im Text von message_text textview in verschiedenen Formaten. Wie kann ich sie aktiv machen?Klickbare URL in Listenansicht
Mein Code:
item_in_message.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bubble_in">
<TextView
android:id="@+id/message_user"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="fdsfsdf"
android:textStyle="normal|bold" />
<TextView
android:id="@+id/message_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/message_user"
android:layout_marginTop="5dp"
android:text="dsfsdfds"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textColor="@android:color/white"
android:textSize="18sp" />
<TextView
android:id="@+id/message_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/message_text"
android:text="sdfsdfsd" />
item_out_message.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="@drawable/bubble_out">
<TextView
android:id="@+id/message_user"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="fdsfsdf"
android:textStyle="normal|bold" />
<TextView
android:id="@+id/message_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/message_user"
android:textColor="@android:color/white"
android:layout_marginTop="5dp"
android:text="dsfsdfds"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="18sp" />
<TextView
android:id="@+id/message_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/message_text"
android:text="sdfsdfsd" />
</RelativeLayout>
Welche Art von 'Links/url' Sie machen bedeuten? Netz? Browser-App sollte geöffnet sein? – eleven
@eleven Einfache URL-Links (z. B. www.google.com, http: // google.com) –