2017-02-20 4 views
0

で特定のテキストを表示し、これは元の文字列のは、たとえば、TextViewのシングルライン

Googleの
のAndroid
ある Gmailの
YouTubeの
アップル
のiOS
TextView

<TextView 
     android:id="@+id/text" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:maxLines="1" 
     android:textSize="16sp" /> 

、私がandroid:maxLines="1"を使用すると、最初の行、つまりGoogleのみが使用されます見えるようにする。 TextViewに他のテキストを表示することはできますか?たとえば、元の文字列を変更せずに最初の行にYoutubeを表示しますか?

答えて

0

私はそれを行う方法はないと思いますが、あなたの文字列を配列形式で保存し、表示したい単語を使用することができます。

myArray[0] = Google 
myArray[1] = Android 
myArray[2] = Gmail 
myArray[3] = Youtube 
myArray[4] = Apple 
myArray[5] = iOS 
関連する問題