I have a list with an adapter, and with this element:

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:paddingLeft="5dp" android:paddingTop="5dp" android:paddingRight="5dp" android:paddingBottom="5dp"> <android.support.v7.widget.CardView android:layout_width="wrap_content" android:layout_height="wrap_content"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="5dp" android:layout_marginEnd="5dp" android:gravity="center_vertical|center_horizontal" android:orientation="horizontal"> <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="90dp" android:ellipsize="end" android:gravity="center_horizontal" android:singleLine="true"/> <TextView android:id="@+id/date" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="250dp" android:gravity="end" android:textSize="12sp" /> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginStart="5dp" android:layout_marginTop="20dp" android:layout_marginEnd="30dp"> <TextView android:id="@+id/address" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="end" android:gravity="center_vertical" android:singleLine="true" /> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginStart="5dp" android:layout_marginTop="40dp" android:layout_marginEnd="5dp"> <TextView android:id="@+id/company" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="5dp" android:ellipsize="end" android:gravity="center_vertical" android:singleLine="true" /> </RelativeLayout> </android.support.v7.widget.CardView> </LinearLayout> 

Data in the list drag on the server response, the answer comes in json. Strange problem - in some elements the appearance of a space in the line responsible for the title (title) is noticed. Already checked in every way:

  1. I looked at what comes from the server - everything is fine.
  2. Checked the presence of a space at the beginning of the lines - nothing.
  3. I looked in the database from where the infa server is pulled - there are no gaps.

For example: enter image description here

The space does not appear in every element, but in some, and visually it is very ugly. It seems there are no spaces, but they are displayed. Changed the markup - it did not help. In the end, I could not find the problem. Most likely the error is somewhere in the markup, but I can not understand exactly where.

  • Look at the headers with and without a space. Is there exactly a space, not alignment, for example? - Enikeyschik
  • @ Enikeyschik, it seems to me that there’s definitely no alignment - I’ve updated the question. - Andrew Goroshko
  • @AndrewGoroshko, you have a left and right margin in RelativeLayout in CardView . - Yuriy SPb 2:13 pm
  • one
    Multiple Layouts like this, try one Constraint. Margin start can also interfere well, and many paddings can be replaced by a common one. Even one linnear to stick together all these will become clear. - Romanovitch
  • one
    For such purposes there is a Layout Inspector in the studio, everything will be written there. - Eugene Krivenja

0