satellite-menu和ArcMenu

github上的开源库其实还是很不错的,之前的时候总感觉学一些开源库比较麻烦,里边有好多方法什么的,今天终于迈出了第一步,中间也遇到了一些问题,现在总结下,也给其他刚开始学习开源库的小伙伴一些指导:

satellite-menu开源库的地址:https://github.com/siyamed/android-satellite-menu

先把这个开源库下载下来,解压,看到如下两个项目和一个README文件。

接下来把这两个项目导入Eclipse(我这里用的是Eclipse开发)

导入后一切正常,没有错误(如果有错误的话clean下就ok了),运行Package Explorer中的satellite-menu-sample,很快就可以在android设备上看到效果了,效果如下:

效果还是蛮不错的嘛,我就动手自己写了一个项目,引用了开源库satellite-menu,引用方法为:

 

引用完了之后呢?就开始写代码了,开始的时候可以仿照下载的example中的例子写

看着没有什么问题,我们就继续在布局文件中添加控件,由于初来乍到,唯恐在细节上担心出错,就直接从example中复制过来,不少错误

我就习惯性的clean了一下,但是还有一个错误,一直没有找到问题的所在,后来虽然发现了下面的代码

 xmlns:sat="http://schemas.android.com/apk/res/android.view.ext"

 

我认为后边的android.view.ext是开源类库中的包名,也就没在意,在网上找了,也找到了答案,但是没有说出原因,我也就没在意,问题的确出在这个地方,这个地方填写的包名是本项目的包名,当我把包名该为我自己写的项目的包名后,再clean下,奇迹般的好了,之前没有发现这些问题,现在竟然发现了,这也是一种收货吧。

下面就开始我的开源之旅……

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
 3     xmlns:sat="http://schemas.android.com/apk/res/com.example.satellitemenudemo2"
 4     android:layout_width="fill_parent"
 5     android:layout_height="fill_parent"
 6     android:orientation="vertical" >
 7 
 8     <android.view.ext.SatelliteMenu
 9         android:id="@+id/menu"
10         android:layout_width="wrap_content"
11         android:layout_height="wrap_content"
12         android:layout_gravity="bottom|left"
13         android:layout_margin="8dp"
14         sat:closeOnClick="true"
15         sat:expandDuration="500"
16         sat:mainImage="@drawable/ic_launcher"
17         sat:satelliteDistance="170dp"
18         sat:totalSpacingDegree="90" />
19 
20     <TextView
21         android:id="@+id/textView1"
22         android:layout_width="wrap_content"
23         android:layout_height="wrap_content"
24         android:layout_gravity="bottom|left"
25         android:layout_margin="8dp" 
26         android:text="@string/app_name"/>
27 
28 </FrameLayout>

 简单介绍下以下的几个属性:

sat:closeOnClick="true"          //true:选中item后自动关闭;false:选中item后不消失
sat:expandDuration="500"        //持续的时间
sat:satelliteDistance="170dp"       //item距离点击menu的距离
sat:totalSpacingDegree="90"       //item所占的角度

sat:mainImage="@drawable/ic_launcher" //(没发现有什么用)

参考地址:

Android卫星菜单:android-satellite-menu - OPEN 开发经验库 http://www.open-open.com/lib/view/open1390737573132.html

Unable to execute dex: Multiple dex files define Landroid错误解决 http://www.cnblogs.com/hxxy2003/archive/2013/04/09/3009416.html

 

两个开源项目的研究:

siyamed/android-satellite-menu https://github.com/siyamed/android-satellite-menu

daCapricorn/ArcMenu https://github.com/daCapricorn/ArcMenu

posted @ 2016-01-12 10:49  HuijunZhang  阅读(1093)  评论(0编辑  收藏  举报
中国