如何为FrameLayout启用Android加速?

时间:2015-03-23 12:38:40

标签: android

我尝试启用我的Android应用程序的加速,但失败了。我的代码如下:

的AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="tsaarni.nativeeglexample"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-sdk android:minSdkVersion="15" android:targetSdkVersion="21"/>
    <application android:label="@string/app_name" 
         android:icon="@drawable/ic_launcher" 
         android:allowBackup="true" 
         android:hardwareAccelerated="true">
        <activity android:name="NativeEglExample"
                  android:hardwareAccelerated="true"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

我也开始了窗口问题:

setContentView(R.layout.main);
getWindow().setFlags(
        WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
        WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);

FrameLayout是在布局xml文件中创建的,我得到了它,但发现加速状态ac为false:

  FrameLayout globalFramelayout = (FrameLayout)findViewById(R.id.my_framelayout);
  boolean ac = globalFramelayout.isHardwareAccelerated(); 

所以,我的问题是:

1. Is my judgement method correct?
2. If that's correct, why ac status is false ?

0 个答案:

没有答案