Android 在我的项目中设置卫星菜单

Android 在我的项目中设置卫星菜单,android,Android,我在这里被指向这个项目: 下载后看起来很棒。但我无法在我的应用程序中使用简单的版本。我已经将提供的.jar添加到我的项目中,它出现在Dependency中。我遇到的问题是xml文件。它是这样提供的: <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:sat="http://sc

我在这里被指向这个项目:

下载后看起来很棒。但我无法在我的应用程序中使用简单的版本。我已经将提供的.jar添加到我的项目中,它出现在Dependency中。我遇到的问题是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>
但是我仍然在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"

在这里发现了一个类似的问题


因此,您只需将包名
android.view.ext
更改为您自己的包名,如
com.tac.grewords
,清理项目,现在一切都应该正常了。

在这里发现了一个类似的问题

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); 
因此,您只需将包名
android.view.ext
更改为您自己的包名,如
com.tac.grewords
,清理项目,现在一切都应该正常了。

SatelliteMenu menu=(SatelliteMenu)findViewById(R.id.satelliteMenu1);
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); 
浮动距离=TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,170,getResources().getDisplayMetrics()); //项目距中心按钮的距离 菜单.设置卫星距离((int)距离); //展开和折叠操作的持续时间(毫秒)。 菜单。设置扩展持续时间(300); menu.SetCloseItemsOn单击(true); //第一项和最后一项之间的度数。 菜单。设置总间隔度(120); 列表项=新建ArrayList(); 添加(新卫星菜单项(6,R.drawable.ic_action_search)); 添加(新卫星菜单项(5,R.drawable.ic_action_search)); 添加(新卫星菜单项(4,R.drawable.ic_action_search)); 添加(新卫星菜单项(3,R.drawable.ic_action_search)); 添加(新卫星菜单项(2,R.drawable.ic_action_search)); 添加(新卫星菜单项(1,R.drawable.ic_action_search)); 菜单.附加项(项目);
从项目属性中将附属菜单添加为库。然后,您将在自定义和库视图中获得附属菜单,只需将其拖放到xml文件中即可。然后将上述代码放入java文件中,该文件实际上为卫星菜单设置了数据。

SatelliteMenu menu=(SatelliteMenu)findViewById(R.id.satelliteMenu1);
浮动距离=TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,170,getResources().getDisplayMetrics());
//项目距中心按钮的距离
菜单.设置卫星距离((int)距离);
//展开和折叠操作的持续时间(毫秒)。
菜单。设置扩展持续时间(300);
menu.SetCloseItemsOn单击(true);
//第一项和最后一项之间的度数。
菜单。设置总间隔度(120);
列表项=新建ArrayList();
添加(新卫星菜单项(6,R.drawable.ic_action_search));
添加(新卫星菜单项(5,R.drawable.ic_action_search));
添加(新卫星菜单项(4,R.drawable.ic_action_search));
添加(新卫星菜单项(3,R.drawable.ic_action_search));
添加(新卫星菜单项(2,R.drawable.ic_action_search));
添加(新卫星菜单项(1,R.drawable.ic_action_search));
菜单.附加项(项目);
从项目属性中将附属菜单添加为库。然后,您将在自定义和库视图中获得附属菜单,只需将其拖放到xml文件中即可。然后将上述代码放入java文件中,该文件实际上为卫星菜单设置了数据。

更改

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

这应该有用,不过对我有用

别忘了清理项目。

更改

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

这应该有用,不过对我有用


别忘了清理项目。

它修复了编译时错误..但是当我运行它时强制关闭它修复了编译时错误..但是当我运行它时强制关闭