1

I have a textview, and when there is more than 2 line of text in it, the second line becomes 1st line, with a line free below it, and the first line should not be visible. is this possible with android textview?

Darko Petkovski
  • 3,742
  • 10
  • 49
  • 110

3 Answers3

1

Try this

<TextView
  android:id="@+id/TextView01"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:singleLine="false"
  android:maxLines="3"
  android:scrollbars="vertical"
  android:textColor="@android:color/secondary_text_dark_nodisable"
>

In Code

TextView textView = (TextView)findViewById(R.id.TextView01);
textView.setMovementMethod(ScrollingMovementMethod.getInstance());
silwar
  • 5,994
  • 2
  • 43
  • 63
0

yes possible. create scrollView with height 2*text_line_height. and add TextView inside . where text_light _height you is proportionate to textSize . so simply try some combinations like 14sp vs 8o dp . good thing is that sp/dp will provide you same behaviour for all device sizes.

Shailendra Singh Rajawat
  • 7,936
  • 2
  • 30
  • 38
0

Yes, take a look.

<ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="match_parent"
        android:layout_height="30dp" >


          <TextView
                android:id="@+id/TextView01"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:singleLine="false"
                android:textSize="20dp"
                android:text="kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk"
                />
    </ScrollView>
Guilherme Gregores
  • 1,020
  • 2
  • 10
  • 26