2013-02-04 24 views
3

首先,我試圖使用這個庫,我試圖讓一個基礎測試程序進行編譯:https://github.com/siyamed/android-satellite-menu實施衛星菜單爲Android,XML文件指出沒有找到資源

我已經保存了項目到我的硬盤並導入到Eclipse。我也確定它正在用Java 1.6進行編譯,並被設置爲'is library'。實際的庫在Eclipse中設置沒有任何錯誤。

至於我的項目,我已經跟着GitHub上列出的說明,但我從我的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' 

這裏就是整個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> 

我的Java源文件:

package com.example.test_satellite_menu; 

import java.util.ArrayList; 
import java.util.List; 

import android.os.Bundle; 
import android.app.Activity; 
import android.view.Menu; 
import android.view.ext.SatelliteMenu; 
import android.view.ext.SatelliteMenuItem; 

public class MainActivity extends Activity { 
SatelliteMenu menu = (SatelliteMenu) findViewById(R.id.menu); 
@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main); 

    List<SatelliteMenuItem> items = new ArrayList<SatelliteMenuItem>(); 
    items.add(new SatelliteMenuItem(4, R.drawable.ic_launcher)); 
    items.add(new SatelliteMenuItem(4, R.drawable.ic_launcher)); 
    items.add(new SatelliteMenuItem(4, R.drawable.ic_launcher)); 
    items.add(new SatelliteMenuItem(3, R.drawable.ic_launcher)); 
    items.add(new SatelliteMenuItem(2, R.drawable.ic_launcher)); 
    items.add(new SatelliteMenuItem(1, R.drawable.ic_launcher)); 
} 

@Override 
public boolean onCreateOptionsMenu(Menu menu) { 
    getMenuInflater().inflate(R.menu.activity_main, menu); 
    return true; 
} 
} 

我確信,我的測試項目有衛星菜單庫inclu戴德,我已經使用'修復項目屬性'以及'乾淨的項目',所以現在我沒有想法:)任何反饋讓這個工作將是真棒。謝謝!


在通過StackOverflow閱讀更多內容後找到了我自己的答案。必須將android.view.awt包名稱更改爲我當前項目的包名稱。

回答

2

在通過StackOverflow閱讀更多內容後找到了我自己的答案。必須將android.view.awt包名稱更改爲我當前項目的包名稱。

+0

嘿我在這個例子中遇到了一些問題,你可以解釋一下執行衛星菜單的步驟.....謝謝 –

+0

如果你能解釋一些可以幫助別人的步驟。 –

+0

我沒有解釋步驟...你改變軟件包名稱(在XML文件中列出)以匹配你的軟件包名稱... –

0
 SatelliteMenu menu = (SatelliteMenu) findViewById(R.id.satelliteMenu1); 
    float distance = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,   170, getResources().getDisplayMetrics()); 
       menu.setSatelliteDistance((int) distance); 
       menu.setExpandDuration(300); 
       menu.setCloseItemsOnClick(true); 
       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); 
1
<FrameLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:sat="http://schemas.android.com/apk/res/com.example.android.activities" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="bottom|center_horizontal" 
    android:layout_weight="0.10" 
    > 

    <com.example.android.activities.SatelliteMenu 
     android:id="@+id/satteliteMenu" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_gravity="bottom|center_horizontal" 
     android:layout_margin="8dp" 
     sat:closeOnClick="false" 
     sat:expandDuration="500" 
     sat:mainImage="@drawable/ic_launcher" 
     sat:satelliteDistance="130dp" 
     sat:totalSpacingDegree="180" /> 
</FrameLayout> 

編輯的xmlns和後/ RES/.. 添加您的項目包名和清除的項目。

+1

你約一年和一個一半遲到:) –

+0

@PaulRuiz比從未更好的遲到。 – Anirudh