I have a weird problem, for some reason the android:ellipsize="end"
works, but added the point in the middle of the text == centered vertically instead of being aligned to baseline:
I checked for any "center" properties, but there is none of those:
Update: This is the XML part:
<com.citylifeapps.cups.customviews.CarmelaTextView
android:id="@+id/venue_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/venue_distance"
android:layout_toRightOf="@+id/venue_name"
android:gravity="left"
android:text="@string/placeholder_venue_address"
android:textColor="@color/cups_white"
android:textSize="20sp"
android:textStyle="bold"
android:ellipsize="end"
android:singleLine="true"
android:scrollHorizontally="true"
android:layout_alignBaseline="@+id/venue_name" />
And the custom TextView
class:
public class CarmelaTextView extends TextView {
public CarmelaTextView(Context context, AttributeSet attrs) {
super(context, attrs);
setCarmelaTypeface(context);
}
public CarmelaTextView(Context context) {
super(context);
setCarmelaTypeface(context);
}
private void setCarmelaTypeface(Context context) {
if (this.isInEditMode()) return;
Typeface typeface = Typeface.createFromAsset(context.getAssets(), "carmela.ttf");
this.setTypeface(typeface);
}
}
further check shows that if I use a simple TextView
the problem disappears,
but there is nothing in the custom TextView
that will cause such a behavior.
Does anyone know why this might happen?
Thanks.