我在这里被指向这个项目:
https://github.com/siyamed/android-satellite-menu
在下载时,它看起来很棒。但是我不能让一个简单的版本在我的应用程序中工作。我已经将提供给我的项目的.jar添加到了我的项目中,并且它出现在依赖项中。我遇到的问题是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"一个和另一个的组合。但我总是得到相同的错误。
我做错了什么?
发布于 2014-10-23 00:40:36
变化
xmlns:sat="http://schemas.android.com/apk/res/android.view.ext至
xmlns:sat="http://schemas.android.com/apk/res-auto"这应该行得通,不过对我来说行得通。
别忘了清理你的项目。
发布于 2013-05-28 22:57:40
在这里发现了一个类似的问题,Implementing Satellite Menu for Android, XML File States No Resource Found
因此,您只需将包名android.view.ext更改为您自己的包名,如com.tac.grewords,清理项目,现在一切都应该正常了。
发布于 2013-12-24 13:58:59
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文件中,它实际设置了卫星菜单的数据。
https://stackoverflow.com/questions/16204734
复制相似问题