2013-04-25 56 views
0

建立一个卫星菜单我已经指出朝着这个项目位置:在我的项目

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

在下载看起来是巨大的。但我无法在我的应用程序中获得简单的版本。我已经添加了提供给我的项目的.jar,它出现在dependsancys中。我遇到的问题是xml文件。它是这样提供的:

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:sat="http://schemas.android.com/apk/res/android.view.ext" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 

    <android.view.ext.SatelliteMenu 
     android:id="@+id/menu" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="bottom|left" 
     android:layout_margin="8dp" 
     sat:satelliteDistance="170dp" 
     sat:mainImage="@drawable/ic_launcher" 
     sat:totalSpacingDegree="90" 
     sat:closeOnClick="true" 
     sat:expandDuration="500"/> 

</FrameLayout> 

SO上的另一篇文章说将包类型更改为您自己的包。所以,我把它改为:

xmlns:sat="http://schemas.android.com/apk/res/my.app" 

但我仍然得到这个错误的XML文件:

Multiple annotations found at this line: 
    - error: No resource identifier found for attribute 'satelliteDistance' in package 
    'android.view.ext' 
    - error: No resource identifier found for attribute 'mainImage' in package 'android.view.ext' 
    - error: No resource identifier found for attribute 'closeOnClick' in package 
    'android.view.ext' 
    - error: No resource identifier found for attribute 'expandDuration' in package 
    'android.view.ext' 
    - error: No resource identifier found for attribute 'totalSpacingDegree' in package 
    'android.view.ext' 

我试图改变这里也包减速:

<android.view.ext.SatelliteMenu 
    android:id="@+id/menu" 

和其中一个的组合。但我只是不断收到同样的错误。

我在做什么错?

回答

2

变化

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

xmlns:sat="http://schemas.android.com/apk/res-auto" 

这应该工作,为我工作虽然。

不要忘记清理您的项目。

0
SatelliteMenu menu = (SatelliteMenu) findViewById(R.id.satelliteMenu1); 
    float distance = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 170, getResources().getDisplayMetrics()); 
    //The distance of items from the center button 
    menu.setSatelliteDistance((int) distance); 
    //The duration of expand and collapse operations in milliseconds. 
    menu.setExpandDuration(300); 
    menu.setCloseItemsOnClick(true); 
    //The degree between the first and the last item. 
    menu.setTotalSpacingDegree(120); 

    List<SatelliteMenuItem> items = new ArrayList<SatelliteMenuItem>(); 
    items.add(new SatelliteMenuItem(6, R.drawable.ic_action_search)); 
    items.add(new SatelliteMenuItem(5, R.drawable.ic_action_search)); 
    items.add(new SatelliteMenuItem(4, R.drawable.ic_action_search)); 
    items.add(new SatelliteMenuItem(3, R.drawable.ic_action_search)); 
    items.add(new SatelliteMenuItem(2, R.drawable.ic_action_search)); 
    items.add(new SatelliteMenuItem(1, R.drawable.ic_action_search)); 
    menu.addItems(items); 

从项目属性中添加卫星菜单作为库。然后,您将在自定义和库视图中将卫星菜单拖放到xml文件中。然后把上面的代码放到你的java文件中,它实际上为卫星菜单设置了数据。