---
title: "viewflow的兼容问题"
author: "hemowolf"
date: "2014-01-15T20:48:27Z"
tags: []
categories: ["移动开发"]
slug: "viewflow"
draft: false
lastmod: "2014-01-15T20:48:27Z"
id: 2004602
url: "https://obacow.iteye.com/blog/2004602"
---

本打算用[ViewFlow](https://github.com/pakerfeldt/android-viewflow/tree/master/viewflow)来实现项目中的相关功能的。在该项目的[主页](https://github.com/pakerfeldt/android-viewflow) 里作者只是提醒在api level8以下注意事项

The manifest states a min sdk version of 4, which is true. But in any case you want to support an api level &lt; 8 you will have to forward an onConfigurationChanged event to the ViewFlow from your Activity. I know this isn't a very nice solution, feel free to propose better ones!

    以为符合我们的项目支持android 2.2以上设备的需求，编译才发现该控件要api level11 以上才行。翻阅代码才发现该控件时使用了View类里从api 11才支持的函数（getMeasuredState）和常量（MEASURED\_STATE\_MASK、MEASURED\_HEIGHT\_STATE\_SHIFT）。

    稍微修改了一下代码兼容api level 4以上设备。