17

So I have this LinearLayout where I use dividers to add some spacing between the items:

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:showDividers="middle"
    android:divider="@drawable/spacer_standard">

    <TextView
        android:id="@+id/product_view_price"
        android:fontFamily="@font/primary_font"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:maxLines="1"/>

    <TextView
        android:id="@+id/product_view_sale_discount"
        android:fontFamily="@font/primary_font"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:maxLines="1"
        android:visibility="gone"
        tools:visibility="visible"/>
</LinearLayout>

This works as expected when the configuration is Left-To-Right, but on Right-To-Left locales the divider shows up, but is ignored (it's rendered behind the textviews and the spacing isn't applied).

Just in case, here's the divider drawable

<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">

<size
    android:width="@dimen/standard_single_margin"
    android:height="@dimen/standard_single_margin" />

<solid android:color="@android:color/transparent" />

I know I can do a workaround by simply adding the dividers manually as views, but I was trying to avoid that since I also use these kinds of dividers on other larger layouts

gonçalo
  • 171
  • 1
  • 4

0 Answers0