1

Does anyone know for what reason arrow is not in the middle of TextView?

Compare how it looks in Android:enter image description here with how it looks in a browser enter image description here

The code adding it looks like this:

for (Ticket ticket : tickets) {
            TextView tvDestination = new TextView(ctx);
            tvDestination.setTextAppearance(ctx, R.style.purchase_row_title);
            tvDestination.setText(ticket.getDepartureStationName() + getDirection(ticket.getTicketType()) + ticket.getArrivalStationName() + " / " + ticket.getDepartureDate());
            tvDestination.setCompoundDrawablesWithIntrinsicBounds(R.drawable.icon_ticket, 0, 0, 0);
            tvDestination.setCompoundDrawablePadding(24);
            tvDestination.setEllipsize(TextUtils.TruncateAt.END);
            tvDestination.setMaxLines(1);
            h.rlDestinations.addView(tvDestination, 0);
        }

Style is:

<style name="purchase_row_title">
    <item name="android:layout_width">wrap_content</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:drawablePadding">10dp</item>
    <item name="android:drawableStart">@drawable/icon_ticket</item>
    <item name="android:maxLines">1</item>
    <item name="android:singleLine">true</item>
    <item name="android:ellipsize">end</item>
    <item name="android:paddingEnd">10dp</item>
    <item name="android:textColor">#242528</item>
    <item name="android:textSize">17sp</item>
    <item name="android:textStyle">bold</item>
</style>
soshial
  • 5,906
  • 6
  • 32
  • 40

1 Answers1

-1

Actually that arrow is in the middle. You should this post and take a understanding about Ascent and Descent of the TextView

Ajeet Choudhary
  • 1,969
  • 1
  • 17
  • 41