I have a TextView that has a height 30px and a textsize 40px. Since the text is taller than the View , I want to display only the middle part of the text. Like this: 
But with android:gravity="center_vertical" I can only display the top of the text with the bottom off. 
And this is my code:
<TextView android:layout_width="wrap_content" android:layout_height="30px" android:textSize="40px" android:text="ABCDEFG" android:gravity="center_vertical" />
Does anyone know how to do this? Thanks!
source share