I am new to Android, i have below task.
I want to align three TextViews adjacent to each other with ellipsis if the text is too long . Currently i am using below code which aligns my TextView adjacent to each other, but my problem is if the text is too long, the below code not putting the ellipsis. i got some trick to use both toleftof
and torightof
from here, but in my case it going to circular dependency as mentioned here.
<RelativeLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_toRightOf="@+id/reminderText">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/noteTagOne"
android:ellipsize="end"
android:singleLine="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/noteTagTwo"
android:ellipsize="end"
android:singleLine="true"
android:layout_toRightOf="@+id/noteTagOne"
android:layout_marginLeft="5sp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/noteTagThree"
android:layout_toRightOf="@+id/noteTagTwo"
android:ellipsize="end"
android:singleLine="true"
android:layout_marginLeft="5sp"/>
</RelativeLayout>
I want output as,
Tag1... Tag2... Tag3...
Basically, i want some ideas, whether in xml i can achieve this or need to do it programmatically, since TextView text's are dynamic i cannot fix maxLength, sometimes only single tag may exist, at that time it should take full text.
Note: I am developing Android project using C# in Xamarin.
Added code is for the above highlighted part. I fixed overlapping of tagsicon & text. Now only two issues.
1) Last tag is overlapping with right aligned image. 2) If TextView texts are short, gap is shown in-between the tags
How to fix it?