Set Toolbar layout direction to RTL, with `supportsRtl="false"`
Asked Answered
A

0

6

I have a special situation that I am not able to find a solution for. I am trying to force a view to be laid-out in RTL, but one of the restrictions is that supportsRtl must be false in the manifest.

<!-- AndroidManifest.xml -->
<application android:supportsRtl="false">

<!-- layout/activity.xml -->
<android.support.v7.widget.Toolbar
    android:layoutDirection="rtl"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>

The problem I'm having is that android:layoutDirection and View#setLayoutDirection(int) are ignored unless supportsRtl="true". Short of making my own Toolbar, what other options are there for handling this?

Angelicaangelico answered 9/10, 2017 at 16:4 Comment(2)
I would suggest to create a custom view and extends Toolbar class and override method hasRtlSupport to always return true (regardless manifest). However, that method is private and can not be overridden :(Pathogenesis
I have the same situation. Even setLayoutDirection cant override that.Affine

© 2022 - 2024 — McMap. All rights reserved.