Java Android布局\u方向\u RTL无法解析或不是字段

Java Android布局\u方向\u RTL无法解析或不是字段,java,android,Java,Android,我有一个布局,我希望该布局被镜像(从右到左)。我在我的应用程序中使用RTL。在我的课堂上,我写了以下内容: @TargetApi(Build.VERSION_CODES.JELLY_BEAN) private void forceRTLIfSupported() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { getWindow().getDecorView().setLayoutDi

我有一个布局,我希望该布局被镜像(从右到左)。我在我的应用程序中使用RTL。在我的课堂上,我写了以下内容:

@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void forceRTLIfSupported() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        getWindow().getDecorView().setLayoutDirection(
                View.LAYOUT_DIRECTION_RTL);
    }
}
这是我的清单文件:

  <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.example.sc3v2"
          android:versionCode="1"
          android:versionName="1.0"
          >
        <uses-sdk   
            android:minSdkVersion="17" 
            android:targetSdkVersion="18"/>

        <application android:icon="@drawable/icon"
             android:label="@string/app_name"
             android:largeHeap="true"
             android:supportsRtl="true"
             >

            <activity 

                android:name="com.example.sc2v1.ViewPagerExampleActivity"
                android:label="@string/app_name"
                android:screenOrientation="landscape"
                android:configChanges="orientation|keyboardHidden"
                android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"
                      >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>

            <activity android:name="com.example.sc2v1.Glossary"
                android:screenOrientation="landscape"
                android:configChanges="orientation|keyboardHidden"
                android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"
                ></activity>

        </application>
    </manifest>

问题是我有两个错误:

  • 我班上的第一个问题是“布局\方向\ RTL无法解析或不是字段”

  • 第二个错误在清单“错误:在包“android”中找不到属性“supportsRtl”的资源标识符”

需要帮忙吗