How to align a TextView in RealtiveLayout along the top of an ImageView ? The upper part of the letter "Z" should touch the purple line)

enter image description here

I tried android:includeFontPadding="false" - no effect.

 <android.support.v7.widget.CardView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/cardView" card:cardElevation="2dp" android:layout_marginBottom="1dp"> <RelativeLayout android:id="@+id/cardInnerContainer" android:layout_width="wrap_content" android:layout_height="match_parent" android:padding="@dimen/inbox_cardPadding"> <ImageView android:id="@+id/cardIcon" android:layout_height="64dp" android:layout_width="64dp" android:layout_marginEnd="10dp" card:srcCompat="@drawable/ic_icon"/> <TextView android:id="@+id/CardTitle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:includeFontPadding="false" android:text="Заголовок" android:layout_alignParentTop="true"/> </RelativeLayout> </android.support.v7.widget.CardView> 

Screenshot from the phone screen (I do not use the emulator):

enter image description here

  • one
    Add a TextView to a layout for clarity of a question, but it’s not clear where it is and how you ask it. I can assume that in addition to android:includeFontPadding=false , you can add more android:padding=0dp , but I’m not sure what will work. - lllyct
  • may help alignBaseline - georgehardcore
  • Did not help. In general, I currently set a negative margin header. - Lateral Gleb
  • principle can be calculated distance. Will you change the style of the text? if not, then it is simple, if so, then you will need to write for a new style. - Shwarz Andrei

0