SlidingMenu icon indicating copy to clipboard operation
SlidingMenu copied to clipboard

Support Action Bar

Open sydneyagcaoili opened this issue 10 years ago • 8 comments

Hi I just want to suggest extending AppCompatActivity in SlideFragmentActivity instead of FragmentActivity.. I wanted it to support the AppCompat ActionBar.

sydneyagcaoili avatar Aug 18 '15 07:08 sydneyagcaoili

You can do it yourself. You just need to add dependencies in SlidingMenu -> gradle compile 'com.android.support:appcompat-v7:23.0.1' and extend SlideFragmentActivity with AppCompatActivity then for action bar you can use widget Toolbar with NoActionbar style for your activity in AndroidManifest.xml. It works for me

zeeshanaslam78 avatar Oct 01 '15 19:10 zeeshanaslam78

@zeeshanaslam78 I used SlidingMenu by extends SlidingFragmentActivity,but there was no toolbar.What did you mean "extend SlideFragmentActivity with AppCompatActivity"?

hellosilence avatar Nov 20 '15 10:11 hellosilence

I have this issue same, I'm wait answer.

ninenox avatar Dec 08 '15 15:12 ninenox

If you aren't understanding @zeeshanaslam78's instructions, then you don't understand your build environment very well. If you are using gradle (Android Studio for example) to build your project, then you need to import appcompat-v7 via the provided compile line above in your SlidingMenu gradle file just as see explained. This makes SlidingMenu aware of the actionBar support in the appCompat library.

Now that you have that, you need to tell SlidingMenu to extend AppCompatActivity, in whichever class you are wanting to use. In my case, and I suspect yours, open SlidingFragmentActivity.java and extend SlidingFragmentActivity with ActionBarActivity like this:

//public class SlidingFragmentActivity extends FragmentActivity implements SlidingActivityBase {
public class SlidingFragmentActivity extends AppCompatActivity implements SlidingActivityBase {

You may want to fix-up the SlidingActivity class as well.

theBlbDan avatar Dec 08 '15 16:12 theBlbDan

How to edit file is locked? I install via

dependencies { compile 'com.jeremyfeinstein.slidingmenu:library:1.3@aar' ... }

ninenox avatar Dec 08 '15 18:12 ninenox

You will need to download SlidingMenu and import it as a project in order to edit the files. Then add to your project's gradle -> dependencies

dependencies {
    compile project(':slidingMenu')
}

Add to settings.gradle

include ':slidingMenu'

In the slidingMenu's gradle file, you want to add compile 'com.android.support:appcompat-v7:23.0.1' to dependencies { }

Here is a write-up on how to do it that might be easier. http://stackoverflow.com/a/20673857/3966095

theBlbDan avatar Dec 08 '15 19:12 theBlbDan

sorry, I have error. Information:Gradle tasks [:SlidingMenu:generateDebugSources, :SlidingMenu:generateDebugAndroidTestSources, :app:generateDebugSources, :app:generateDebugAndroidTestSources] :SlidingMenu:preBuild UP-TO-DATE :SlidingMenu:preDebugBuild UP-TO-DATE :SlidingMenu:checkDebugManifest :SlidingMenu:preDebugAndroidTestBuild UP-TO-DATE :SlidingMenu:preDebugUnitTestBuild UP-TO-DATE :SlidingMenu:preReleaseBuild UP-TO-DATE :SlidingMenu:preReleaseUnitTestBuild UP-TO-DATE :SlidingMenu:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE :SlidingMenu:prepareComAndroidSupportSupportV42311Library UP-TO-DATE :SlidingMenu:prepareDebugDependencies :SlidingMenu:compileDebugAidl UP-TO-DATE :SlidingMenu:compileDebugRenderscript :SlidingMenu:generateDebugBuildConfig UP-TO-DATE :SlidingMenu:generateDebugAssets UP-TO-DATE :SlidingMenu:mergeDebugAssets UP-TO-DATE :SlidingMenu:generateDebugResValues UP-TO-DATE :SlidingMenu:generateDebugResources :SlidingMenu:mergeDebugResources UP-TO-DATE :SlidingMenu:processDebugManifest UP-TO-DATE :SlidingMenu:processDebugResources /Users/Ninenox/Desktop/clone/Smitn/SlidingMenu/build/intermediates/res/merged/debug/values-ldltr-v21/values-ldltr-v21.xml Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner.Underlined'. /Users/Ninenox/Desktop/clone/Smitn/SlidingMenu/build/intermediates/res/merged/debug/values-ldrtl-v23/values-ldrtl-v23.xml Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner.Underlined'. /Users/Ninenox/Desktop/clone/Smitn/SlidingMenu/build/intermediates/res/merged/debug/values-v21/values-v21.xml Error:(13) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'. Error:(15) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large.Inverse'. Error:(21) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium.Inverse'. Error:(28) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small.Inverse'. Error:(203) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar'. Error:(205) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar.Horizontal'. Error:(213) Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material'. Error:(220) Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light'. Error:(165) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.AutoCompleteTextView'. Error:(176) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.EditText'. Error:(6) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'. Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material'. Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body1'. Error:(5) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body2'. Error:(7) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Caption'. Error:(8) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display1'. Error:(9) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display2'. Error:(10) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display3'. Error:(11) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display4'. Error:(12) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Headline'. Error:(14) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large'. Error:(16) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'. Error:(18) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'. Error:(20) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium'. Error:(22) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Menu'. Error:(23) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.SearchResult.Subtitle'. Error:(25) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.SearchResult.Title'. Error:(27) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small'. Error:(29) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Subhead'. Error:(30) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Title'. Error:(31) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Menu'. Error:(33) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'. Error:(35) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle.Inverse'. Error:(37) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'. Error:(39) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title.Inverse'. Error:(41) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Subtitle'. Error:(43) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Title'. Error:(45) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button'. Error:(46) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'. Error:(48) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'. Error:(50) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'. Error:(51) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.TextView.SpinnerItem'. Error:(52) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'. Error:(54) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'. Error:(154) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabText'. Error:(156) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabView'. Error:(158) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'. Error:(160) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.CloseMode'. Error:(163) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.Overflow'. Error:(168) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button'. Error:(169) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Borderless'. Error:(170) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Borderless.Colored'. Error:(171) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Small'. Error:(172) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ButtonBar'. Error:(173) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.CompoundButton.CheckBox'. Error:(174) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.CompoundButton.RadioButton'. Error:(175) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.DropDownItem.Spinner'. Error:(179) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ImageButton'. Error:(180) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'. Error:(182) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'. Error:(184) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabView'. Error:(186) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.PopupMenu'. Error:(192) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListPopupWindow'. Error:(194) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView'. Error:(195) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView.DropDown'. Error:(197) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.PopupMenu'. Error:(207) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.RatingBar'. Error:(208) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.SeekBar'. Error:(209) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner'. Error:(210) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.TextView.SpinnerItem'. Error:(211) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Toolbar.Button.Navigation'. /Users/Ninenox/Desktop/clone/Smitn/SlidingMenu/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.1.1/res/values-v21/values-v21.xml Error:(82, 5) No resource found that matches the given name: attr 'android:colorAccent'. Error:(82, 5) No resource found that matches the given name: attr 'android:colorButtonNormal'. Error:(82, 5) No resource found that matches the given name: attr 'android:colorControlActivated'. Error:(82, 5) No resource found that matches the given name: attr 'android:colorControlHighlight'. Error:(82, 5) No resource found that matches the given name: attr 'android:colorControlNormal'. Error:(82, 5) No resource found that matches the given name: attr 'android:colorPrimary'. Error:(82, 5) No resource found that matches the given name: attr 'android:colorPrimaryDark'. Error:(126, 5) No resource found that matches the given name: attr 'android:windowElevation'. Error:(129, 5) No resource found that matches the given name: attr 'android:colorAccent'. Error:(129, 5) No resource found that matches the given name: attr 'android:colorButtonNormal'. Error:(129, 5) No resource found that matches the given name: attr 'android:colorControlActivated'. Error:(129, 5) No resource found that matches the given name: attr 'android:colorControlHighlight'. Error:(129, 5) No resource found that matches the given name: attr 'android:colorControlNormal'. Error:(129, 5) No resource found that matches the given name: attr 'android:colorPrimary'. Error:(129, 5) No resource found that matches the given name: attr 'android:colorPrimaryDark'. Error:(173, 5) No resource found that matches the given name: attr 'android:windowElevation'. Error:(212, 5) No resource found that matches the given name: attr 'android:overlapAnchor'. Error:(223, 5) No resource found that matches the given name: attr 'android:overlapAnchor'. Error:(253, 5) No resource found that matches the given name: attr 'android:colorAccent'. Error:(253, 5) No resource found that matches the given name: attr 'android:colorButtonNormal'. Error:(253, 5) No resource found that matches the given name: attr 'android:colorControlActivated'. Error:(253, 5) No resource found that matches the given name: attr 'android:colorControlHighlight'. Error:(253, 5) No resource found that matches the given name: attr 'android:colorControlNormal'. Error:(253, 5) No resource found that matches the given name: attr 'android:colorPrimary'. Error:(253, 5) No resource found that matches the given name: attr 'android:colorPrimaryDark'. /Users/Ninenox/Desktop/clone/Smitn/SlidingMenu/build/intermediates/res/merged/debug/values-v23/values-v23.xml Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'. Error:(24) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'. Error:Execution failed for task ':SlidingMenu:processDebugResources'.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/Ninenox/Library/Android/sdk/build-tools/19.1.0/aapt'' finished with non-zero exit value 1 Information:BUILD FAILED Information:Total time: 1.872 secs Information:101 errors Information:0 warnings Information:See complete output in console

ninenox avatar Dec 09 '15 15:12 ninenox

Learn to Google. From http://stackoverflow.com/a/26457138/3966095

AppCompat v21 builds themes that require the new APIs provided in API 21 (Android 5.0).
To compile your application with AppCompat, you must also compile against API 21.
The recommended setup for compiling/building with API 21 is a compileSdkVersion
of 21 and a buildToolsVersion of 21.0.1 (which is the highest at this time -
you always want to use the latest build tools)

Use the proper versions for what you're doing. For example, I have

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"
    defaultConfig {
        ...
        minSdkVersion 11
        targetSdkVersion 23
    }
...

Don't simply copy/paste what others are doing. Use them as guides to correct your project.

theBlbDan avatar Dec 09 '15 17:12 theBlbDan