0

「こんにちは、お元気ですか\nこれは私の「2番目のアクティビティ」です。」のような長いテキストがTextViewにあります。「Second Activity」テキストのみをクリック可能にしたい。

私は ScrollView で TextView を使用しています このように:

<ScrollView android:id="@+id/scrollView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/gold_btn" android:orientation="vertical"><TextView android:id="@+id/text1" android:layout_width="match_parent" android:layout_height="wrap_content" android:textColor="#FFEFFF" android:text="" android:textSize="23sp"/></ScrollView>

text1.setText("Hello How Are You This Is my Second Activity"); を使用してコード内のテキストを設定します。「2番目のアクティビティ」テキストをクリック可能にしたいのですが、ユーザーが「2番目のアクティビティ」テキストをクリックすると、別のアクティビティが開きます。

文字列は非常に長く、改行もあります。

4

2 に答える 2

1

ClickableSpan の使用を検討する必要があります

ここで似たようなものを見つけるでしょう。

テキストビューの一部をクリッカブルにする方法

于 2013-08-29T14:36:49.530 に答える
0

複数のテキストビューを追加し、クリックするテキストビューに onclick を配置します。

<TextView
    android:id="@+id/text1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text=""
    android:textColor="#FFEFFF"
    android:textSize="23sp"
    android:onClick="doSomething"
     />

役立つリンク

于 2013-08-29T14:39:30.803 に答える