I have below layout in my xml which will contain 3 TextView and they are aligned left, centre and right respectively.
<RelativeLayout
        android:id="@+id/relRow1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:text="@string/contact"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:text="@string/colon"
            android:id="@+id/colonRow1"/>
        <TextView
            android:id="@+id/txtPrimaryContact"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true"
            android:layout_toEndOf="@+id/colonRow3"
            android:layout_toRightOf="@+id/colonRow3"
            android:ellipsize="end"
            android:gravity="end"
            android:maxLines="1"
            android:text="Joe SmithMartinWilliamCathcsdsdsdadas"/>
</RelativeLayout>
The problem I am facing now is that, the ellipsize doesn't go well or work as expected with android device version < 6.0. I mean for device with Marshmallow version, the ellipsize is breaking the text once max width is reached, but for devices having lollipop or kitkat version, may be lower too, the , it does not break for long text.ellipsize breaks down after space in text and displays ellipses
Here is how it looks in android version less than Marshmallow:
Consider the name is FName LName
Contact : FName...
Here is how it looks in android version greater than Marshmallow:
Contact : FName LNa...
Is this a bug in lower versions or expected behavior. Or is there any other way to do this? I would like to have the Marshmallowversion text in all the devices. Anyway I can achieve this?
Update
Turns out, my assumption was wrong after @Charu's comment. It actually hides out for long text in device version < Marshmallow. How can I come over this?
Right now I've been using below code, but that doesn't scale up when we check with different devices with different screen size. I've attached screenshots for reference.
if(android.os.Build.VERSION.SDK_INT<Build.VERSION_CODES.M && name.length()>20)
     name=name.substring(0,20)+"...";
else
     txtPrimaryContact.setEllipsize(TextUtils.TruncateAt.END);
>=Marshmallow device
< Marshmallow device [Kitkat to be specific but tested in Lollipop too]


 
    