如何在 android/eclipse 上设置 Jfeinstein10 滑动菜单

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13991496/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 19:40:17  来源:igfitidea点击:

How to set up Jfeinstein10 sliding menu on android/eclipse

androideclipsemenucompiler-errorssliding

提问by Mdlc

I am trying to setup JFeinstein10's sliding menuin eclipse.

我正在尝试在 Eclipse 中设置 JFeinstein10 的滑动菜单

What i've tried:

我试过的:

  1. file > import > from existing android.. > select the library of sliding menu
  2. file > import > from ex.. > select the example of sliding me
  3. file > import > from ex.. > select actionbarsherlock library
  4. mark slidingmenu lib and actionbarlib as library
  5. add the library's to example of sldingmenu
  6. cleanup all
  1. file > import > from existing android.. > select the library of sliding menu
  2. file > import > from ex.. > select the example of sliding me
  3. file > import > from ex.. > select actionbarsherlock library
  4. mark slidingmenu lib and actionbarlib as library
  5. add the library's to example of sldingmenu
  6. cleanup all

and then i get various errors (like: jar mismatch, .. cannot be resolved to a type, the method .. of type .. must override a superclass method) i googled them and use the cleanup and quick fix options. but i doesn't work.

然后我收到各种错误(例如:jar 不匹配,.. 无法解析为类型,类型 .. 的方法 .. 必须覆盖超类方法)我用谷歌搜索它们并使用清理和快速修复选项。但我不工作。

I hope one of you knows a good tutorial, or maybe is able to write one or knows what to do.

我希望你们中的一个人知道一个好的教程,或者可能会写一个或知道该怎么做。

I'm new to android development, all my previous apps are made in a webview.

我是 android 开发的新手,我以前的所有应用程序都是在webview.

I've also tried https://github.com/johnkil/SideNavigation(didn't work either, if someone knows how to setup this, great to!) and grimbo sliding menu (it worked, but it's not what i'm looking for)

我也试过https://github.com/johnkil/SideNavigation(也没有工作,如果有人知道如何设置这个,太好了!)和 grimbo 滑动菜单(它工作,但它不是我想要的寻找)

errors are in library only in slidingmapactivity(showed below) and in actibarsherlocklibrary there are many files with errors (almost in any file in src folder)

错误仅在库中slidingmapactivity(如下所示)并且在actibarsherlock库中有许多文件有错误(几乎在 src 文件夹中的任何文件中)

code in lib: slidingmapactivity:
package com.slidingmenu.lib.app;

import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup.LayoutParams;

import com.slidingmenu.lib.SlidingMenu;

public abstract class SlidingMapActivity extends MapActivity implements         SlidingActivityBase {

private SlidingActivityHelper mHelper;

/* (non-Javadoc)
 * @see com.google.android.maps.MapActivity#onCreate(android.os.Bundle)
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mHelper = new SlidingActivityHelper(this);
    mHelper.onCreate(savedInstanceState);
}

/* (non-Javadoc)
 * @see android.app.Activity#onPostCreate(android.os.Bundle)
 */
@Override
public void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    mHelper.onPostCreate(savedInstanceState);
}

/* (non-Javadoc)
 * @see android.app.Activity#findViewById(int)
 */
@Override
public View findViewById(int id) {
    View v = super.findViewById(id);
    if (v != null)
        return v;
    return mHelper.findViewById(id);
}

/* (non-Javadoc)
 * @see android.app.Activity#onSaveInstanceState(android.os.Bundle)
 */
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    mHelper.onSaveInstanceState(outState);
}

/* (non-Javadoc)
 * @see android.app.Activity#setContentView(int)
 */
@Override
public void setContentView(int id) {
    setContentView(getLayoutInflater().inflate(id, null));
}

/* (non-Javadoc)
 * @see android.app.Activity#setContentView(android.view.View)
 */
@Override
public void setContentView(View v) {
    setContentView(v, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
}

/* (non-Javadoc)
 * @see android.app.Activity#setContentView(android.view.View, android.view.ViewGroup.LayoutParams)
 */
@Override
public void setContentView(View v, LayoutParams params) {
    super.setContentView(v, params);
    mHelper.registerAboveContentView(v, params);
}

/* (non-Javadoc)
 * @see com.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(int)
 */
@Override
public void setBehindContentView(int id) {
    setBehindContentView(getLayoutInflater().inflate(id, null));
}

/* (non-Javadoc)
 * @see com.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(android.view.View)
 */
@Override
public void setBehindContentView(View v) {
    setBehindContentView(v, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
}

/* (non-Javadoc)
 * @see com.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(android.view.View, android.view.ViewGroup.LayoutParams)
 */
@Override
public void setBehindContentView(View v, LayoutParams params) {
    mHelper.setBehindContentView(v, params);
}

/* (non-Javadoc)
 * @see com.slidingmenu.lib.app.SlidingActivityBase#getSlidingMenu()
 */
@Override
public SlidingMenu getSlidingMenu() {
    return mHelper.getSlidingMenu();
}

/* (non-Javadoc)
 * @see com.slidingmenu.lib.app.SlidingActivityBase#toggle()
 */
@Override
public void toggle() {
    mHelper.toggle();
}

/* (non-Javadoc)
 * @see com.slidingmenu.lib.app.SlidingActivityBase#showAbove()
 */
@Override
public void showContent() {
    mHelper.showContent();
}

/* (non-Javadoc)
 * @see com.slidingmenu.lib.app.SlidingActivityBase#showBehind()
 */
@Override
public void showMenu() {
    mHelper.showMenu();
}

/* (non-Javadoc)
 * @see com.slidingmenu.lib.app.SlidingActivityBase#showSecondaryMenu()
 */
@Override
public void showSecondaryMenu() {
    mHelper.showSecondaryMenu();
}

/* (non-Javadoc)
 * @see com.slidingmenu.lib.app.SlidingActivityBase#setSlidingActionBarEnabled(boolean)
 */
@Override
public void setSlidingActionBarEnabled(boolean b) {
    mHelper.setSlidingActionBarEnabled(b);
}

/* (non-Javadoc)
 * @see android.app.Activity#onKeyUp(int, android.view.KeyEvent)
 */
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    boolean b = mHelper.onKeyUp(keyCode, event);
    if (b) return b;
    return super.onKeyUp(keyCode, event);
}

}

}

采纳答案by Rawkode

Well let's deal with these problems one at a time ...

好吧,让我们一次一个地处理这些问题......

  • JAR Mismatch - I presume this is the support library. Replace the JAR in the SlidingMenu libsfolder with the copy from your own libsfolder.

  • Cannot be resolved to a typesuggests that you haven't clicked on your projects properties and added SlidingMenu to the libraries box. Failing that, press Cmd-Shift-Owithin your Activity file to fix your imports. This will also fix your @Overrideissues I believe.

  • JAR 不匹配 - 我认为这是支持库。将 SlidingMenulibs文件夹中的 JAR 替换为您自己libs文件夹中的副本。

  • Cannot be resolved to a type表明您尚未单击项目属性并将 SlidingMenu 添加到库框中。如果失败,请Cmd-Shift-O在您的活动文件中按下以修复您的导入。@Override我相信这也将解决您的问题。

Let me know how you get on and I'll provide further assistance as required.

让我知道你的进展情况,我会根据需要提供进一步的帮助。

回答by Yogeshbalan

You need to have same android-support-v4 JAR in both of you SLIDINGMENULIBRARY's libs directory as well as you PROJECT's libs folder.

您需要在 SLIDINGMENULIBRARY 的 libs 目录和 PROJECT 的 libs 文件夹中拥有相同的 android-support-v4 JAR。

As a matter of fact go to you SDK folder the go to sdk\extras\android\support\v4\android-support-v4.jar copy this jar and paste it into both directories.

事实上,转到您的 SDK 文件夹,然后转到 sdk\extras\android\support\v4\android-support-v4.jar 复制这个 jar 并将其粘贴到两个目录中。