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?
            Asked
            
        
        
            Active
            
        
            Viewed 593 times
        
    3 Answers
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
        
- 6,470
- 3
- 46
- 66
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
        
- 8,172
- 3
- 35
- 40
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,050
- 2
- 10
- 27
