移植SlidingMenu Android library,和安装example出现的问题解决
很多项目都用到类似左侧滑动菜单的效果,比如facebook,evernote,VLC for android等等,这很酷
源代码可以从GitHub的https://github.com/jfeinstein10/slidingmenu上下载。
移植过程中会用到Actionbarsherlock这个项目,去http://actionbarsherlock.com/download.html下载。(两个下的都是最新版本)
步骤:
1.将下载的Actionbarssherlock中/library下的文件解压到workspace(你的项目目录),改项目名称为Actionbarssherlock,从eclipse中操作new->project->Android Project from Existing Code将项目添加进去,target改为api14以上。
2.将下载的slidingmenu中/library解压到workspace(你的项目目录),改名SlidingMenu,import该项目,右键->properties->android->api14以上。或者打开project.properties:target=Google Inc.:Google APIs:14或更高。
3.这样SlidingMenu就可以用在自己项目中了。让我们来运行例子。解压slidingmenu中/example。import该项目,设置api14或更高,并add你的SlidingMenu。运行看看效果。2.1以上的系统都可以运行。
虽然是开源项目,但使用过程中还是可能会出现各种问题:
一、修复SlidingMenu library project里出现的错误
Console error: Unable to resolve target ‘Google Inc.:Google APIs:16.
Fix: 进入Properties检查Target sdk是否选择了 Google APIs.
List of errors: ACTION_POINTER_INDEX_MASK cannot be resolved android.
HONEYCOMB cannot be resolved or is not a field
LAYER_TYPE_HARDWARE cannot be resolved or is not a field
LAYER_TYPE_NONE cannot be resolved or is not a field
MATCH_PARENT cannot be resolved or is not a field
The method getLayerType() is undefined for the type View
The method setLayerType(int, null) is undefined for the type ViewFix: 将manifest里面的min sdk version 改为你当前用到的sdk版本,7以上.
二、修复example project里出现的错误
Console error: Found 2 versions of android-support-v4.jar in the dependency list,but not all the versions are identical (check is based on SHA-1 only at this time). Jar mismatch! Fix your dependencies
Fix: 这是由于jar包版本不一致导致的,检查SlidingMenu和Actionbarsherlock中的\libs文件夹里的哪个android-support-v4.jar版本比较新,用新的替换掉其中的老版本. 如果错误还是会出现,就clean项目并重启eclipse.
List of errors: The method getSupportActionBar() is undefined for the type BaseActivity
The method getSupportMenuInflater() is undefined for the type BaseActivity
The method onCreateOptionsMenu(Menu) of type BaseActivity must override or implement a supertype method
The method onOptionsItemSelected(MenuItem) in the type Activity is not applicable for the arguments
The method onOptionsItemSelected(MenuItem) of type BaseActivity must override or implement a supertype method
The method onOptionsItemSelected(MenuItem) of type ResponsiveUIActivity must override or implement a supertype methodFix:打开SlidingMenu library project里SlidingFragmentActivity这个类并在声明前添加以下代码:
- import com.actionbarsherlock.app.SherlockFragmentActivity;
然后,将下面这个父类:
- public class SlidingFragmentActivity extends FragmentActivity implements SlidingActivityBase {
换成Actionbarsherlock里的另外一个父类:
- public class SlidingFragmentActivity extends SherlockFragmentActivity implements SlidingActivityBase {
如果错误还是会出现,就clean项目并重启eclipse.
没错误以后运行出下面效果:
- 原文:http://blog.csdn.net/zoeice/article/details/8721137
移植SlidingMenu Android library,和安装example出现的问题解决的更多相关文章
- 转:移植SlidingMenu Android library,和安装example出现的问题解决
很多项目都用到类似左侧滑动菜单的效果,比如facebook,evernote,VLC for android等等,这很酷 源代码可以从GitHub的https://github.com/jfeinst ...
- 将Unity3D游戏移植到Android平台上
将Unity3D游戏移植到Android平台是一件很容易的事情,只需要在File->Build Settings中选择Android平台,然后点击Switch Platform并Build出ap ...
- android studio开发工具的android library打包文件(.aar)本地引用
by 蔡建良 2014-5-13 关键点: 利用Gradle发布本地maven库支持android library 打包文件(*.aar) 的本地引用 开发环境: windows7 64位操作系统 a ...
- Windows下将ImageMagick移植到Android平台
Windows下将ImageMagick移植到Android平台 原文链接 http://www.pedant.cn/2014/06/18/imagemagick-ported-android/ I ...
- React Native移植原生Android
(一)前言 之前已经写过了有关React Native移植原生Android项目的文章,不过因为RN版本更新的原因吧,跟着以前的文章可能会出现一些问题,对于初学者来讲还是会有很多疑难的困惑的,而且官方 ...
- 【C++】GSL(GNU Scientific Library) 的安装及在 Visual Studio 2017 中的使用
GSL 是 GNU 开发并维护的科学计算的库,其中包括: 复数 多项式的根 特殊函数 向量和矩阵 排列 排序 BLAS支持 线性代数 Eigensystems 快速傅立叶变换 正交 随机数 准随机序列 ...
- Android Library项目发布到JCenter最简单的配置方法
前沿 网上的步骤看起来实在太麻烦,gituhb上偶然间看到的一个项目,经过实际验证确实可行.github连接:https://github.com/xiaopansky/android-library ...
- Android Library开发注意事项
Android Library开发注意事项 App Module添加依赖Android Library时可以设置library的优先级, 在编译时,app按照library从低到高的优先级依次与每个l ...
- 【React Native开发】React Native移植原生Android项目(4)
),React Native技术交流4群(458982758),请不要反复加群!欢迎各位大牛,React Native技术爱好者加入交流!同一时候博客左側欢迎微信扫描关注订阅号,移动技术干货,精彩文章 ...
随机推荐
- 丹佛机场行李系统Postmortem
丹佛机场行李系统做Postmortem总结 事情起因是因为丹佛市场承诺进行机场建设,因此此项目问题不可回避,必须完成,合作的双方都是富有经验的公司但是最后依然变成了不可控的项目,经过小组讨论后我们认为 ...
- python多线程的用法之一
import threadingimport time class thread_1(threading.Thread): sleep_time = 0 def __init__(self,id1): ...
- ubuntu共享文件配置
目标:实现windows和linux混合组成的操作 系统中可以共享文件,并可以通过机器名互相访问 安装文件共享服务 0.更改本机主机名,修改 /etc/hostname文件和/etc/hosts文件中 ...
- storysnail的Windows串口编程笔记
storysnail的Windows串口编程笔记 作者 He YiJun – storysnail<at>gmail.com 团队 ls 版权 转载请保留本声明! 本文档包含的原创代码根据 ...
- Python札记 -- MongoDB模糊查询
最近在使用MongoDB的时候,遇到了使用多个关键词进行模糊查询的场景.竹风使用的是mongoengine库. 查了各种资料,最后总结出比较好用的方法.先上代码,后面进行详细说明.如下: #!/usr ...
- 【腾讯Bugly干货分享】腾讯验证码的十二年
本文来自于腾讯bugly开发者社区,未经作者同意,请勿转载,原文地址:http://dev.qq.com/topic/581301b146dfb1456904df8d Dev Club 是一个交流移动 ...
- 打通移动App开发的任督二脉、实现移动互联创业的中国梦
年初的两会上,第一次听到克强总理讲到“互联网+”的计划,当时就让我为之感到无比振奋.我个人的理解是:“互联网+”的本质就是要对传统行业供需双方的重构,通过移动互联技术来推动各个行业上的全民创新,促使中 ...
- FusionCharts简单教程(六)------加载外部Logo
一.加载外部文件Logo 在使用FusionCharts时,我们可能需要在加载图像的时候需要在图表中显示标识.图片等等.这里我们可以使用logoURL属性来实现.如: <chart ...
- SQL-geography && Spatial result
说起geography(地理)这个类型,我感觉好陌生,以前真的没有见过,今天在查询某个Address表的时候,却发现了新大陆——Spatial result(空间的结果). (1)表的结构 (2)查询 ...
- Redis和Memcached的区别详解
转载于:http://www.itxuexiwang.com/a/shujukujishu/redis/2016/0216/119.html?1455855360 Redis的作者Salvatore ...