首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在我的项目中设置附属菜单

在我的项目中设置附属菜单
EN

Stack Overflow用户
提问于 2013-04-25 09:00:22
回答 3查看 2.6K关注 0票数 0

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

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

在下载时,它看起来很棒。但是我不能让一个简单的版本在我的应用程序中工作。我已经将提供给我的项目的.jar添加到了我的项目中,并且它出现在依赖项中。我遇到的问题是xml文件。它是这样提供的:

代码语言:javascript
复制
<?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上的另一篇文章说,将包类型更改为您自己的包。因此我将其更改为:

代码语言:javascript
复制
xmlns:sat="http://schemas.android.com/apk/res/my.app"

但是我仍然在xml文件中得到这个错误:

代码语言:javascript
复制
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'

我在这里也尝试过改变包的减速:

代码语言:javascript
复制
<android.view.ext.SatelliteMenu
    android:id="@+id/menu"

一个和另一个的组合。但我总是得到相同的错误。

我做错了什么?

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2014-10-23 00:40:36

变化

代码语言:javascript
复制
xmlns:sat="http://schemas.android.com/apk/res/android.view.ext

代码语言:javascript
复制
xmlns:sat="http://schemas.android.com/apk/res-auto"

这应该行得通,不过对我来说行得通。

别忘了清理你的项目。

票数 2
EN

Stack Overflow用户

发布于 2013-05-28 22:57:40

在这里发现了一个类似的问题,Implementing Satellite Menu for Android, XML File States No Resource Found

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

票数 1
EN

Stack Overflow用户

发布于 2013-12-24 13:58:59

代码语言:javascript
复制
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文件中,它实际设置了卫星菜单的数据。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16204734

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档