问题
I'm building an app which will run from Android version 2.2 (Froyo) onwards. I have already built an app with 2.2 for playing videos and in the same app I want to run on Android version 3 (Honeycomb).
And here my problem starts with hardware_ accelerated flag. This flag is available from Honeycomb 3 onwards, but not below Honeycomb. I want to ship one common app with Froyo, but as I'm trying my app in Honeycomb, video is not shown. It's clearly because of the hardware_ accelerated flag. I can release two builds, but I just want to give one try. Can I avoid that?
My problem is I want to ship the app with Froyo, but for hardware_accelerated flag, it has a reference, not a manifest or in the programmatically coding since it's Froyo. I'm using webview from where the videos will be played.
回答1:
Tried to set only the window in hardware accelerated mode:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
getWindow().setFlags(
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
}
And your manifest shoud set SDK compatibility to:
<uses-sdk android:minSdkVersion="8"
android:targetSdkVersion="11" />
And add the android-support-v4.jar lib to your project.
However, your problem might be somewhere else.
回答2:
I did the trick the other way around. I built an app in Honeycomb (Android 3.0) itself. And allowed to support Froyo (Android 2.2) in the manifest.
来源:https://stackoverflow.com/questions/16235637/hardware-acceleration-flag