satellite-menu和ArcMenu

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

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

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

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

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

效果仍是蛮不错的嘛,我就动手本身写了一个项目,引用了开源库satellite-menu,引用方法为:布局

 

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

看着没有什么问题,咱们就继续在布局文件中添加控件,因为初来乍到,惟恐在细节上担忧出错,就直接从example中复制过来,很多错误spa

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

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

 

我认为后边的android.view.ext是开源类库中的包名,也就没在乎,在网上找了,也找到了答案,可是没有说出缘由,我也就没在乎,问题的确出在这个地方,这个地方填写的包名是本项目的包名,当我把包名该为我本身写的项目的包名后,再clean下,奇迹般的好了,以前没有发现这些问题,如今居然发现了,这也是一种收货吧。xml

下面就开始个人开源之旅……

 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

相关文章
相关标签/搜索