i removed Action Bar from all activities Then I put to specific activity an action bar and when i used SupportsRtl (in Specifed Activity) for change title position but title position still no changed
styles :
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="myTheme" parent="Theme.AppCompat.Light">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:textColorPrimary">#FFFFFF</item>
</style>
</resources>
Manifest :
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.user.classmanager">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".FirstTab" />
<activity android:name=".SecondTab" />
<activity android:name=".ThirdTab" />
<activity android:name=".AddNewClass"
android:theme = "@style/myTheme"
android:supportsRtl="true" <==== DONT WORK
android:label="اضافه کردن کلاس">
</activity>
</application> </manifest>
You can't do such thing in Manifest.xml
.
I recommend set android:layoutDirection="rtl"
into your activity parent layout to set just that specific activity support rtl.
this article has great information about layout directions support.
When you enable support for RTL layouts like this:
<application
...
android:supportsRtl="true">
You enable the use of this feature for every activity in the app.
This suggests that the problem probably lies in the layout of your AppBarLayout
/ Toolbar
.
In order for the application to properly reflect the direction, you should use the appropriate attributes - instead of using Left
/Right
, you should use Start
/End
ones. To read more check Android Developers Blog.
You can also use the automatic Android Studio option by selecting Refactor > Add RTL Support Where Possible...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With