如何在AndroidManifest中为指定的活动设置SupportRTL

如何在AndroidManifest中为指定的活动设置SupportRTL,android,android-layout,android-actionbar,android-manifest,Android,Android Layout,Android Actionbar,Android Manifest,我从所有活动中删除了操作栏,然后将操作栏放在特定活动中,当我使用SupportsRtl(在指定活动中)更改标题位置时,标题位置仍然没有更改 风格: <resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <!-- Customize your theme here. -->

我从所有活动中删除了操作栏,然后将操作栏放在特定活动中,当我使用SupportsRtl(在指定活动中)更改标题位置时,标题位置仍然没有更改

风格:

<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>

@颜色/原色
@颜色/原色暗
@颜色/颜色重音
@颜色/原色
@颜色/原色暗
@颜色/颜色重音
#FFFFFF
舱单:

<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>


当您启用对RTL布局的支持时,如下所示:

<application
    ...
    android:supportsRtl="true">

您还可以通过选择重构来使用自动Android Studio选项,在可能的情况下添加RTL支持…


您不能在
Manifest.xml
中执行此类操作

我建议将
android:layoutDirection=“rtl”
设置到活动父级布局中,以便仅设置特定的活动支持rtl


在你的
.AddNewClass
中你得到了标题吗?你的目标是什么
SDK
android:supportsRtl=“true”
中的
应用程序
标记仅在API 17及以上版本中可用。通过设置
android:layoutDirection=“rtl”
您不支持从右向左的布局方向,但强制所有语言使用它(LTR将不再工作)是的,但是当所有页面都使用一种RTL语言时,它就工作了。谢谢你回答我的问题,我测试了>>android:layoutDirection=“RTL”