Warning!
2018-06-15 DeprecatedSince this guide was made long before they introduced Themes and the possibility of using Extensions, this was the only way to achieve Sidebar/Side Menu at the time.
Notice
2016-06-24New version AppToMarket 4.1 which doesn’t require Internet connection
Using AppToMarket 4.1 and Screen2 in your project you can achieve this.
Important!
Guidelines sinceMIT AI2 release (nb144)
Let us begin by making Screen1 and Screen2 that we will use as sidebar or side menu.
Screen1 Designer:
ShowStatusBar: Checked
TitleVisible: Checked
Sizing: I prefer responsive before fixed
Screen2 Designer:
BackgroundColor: None
BackgroundImage: None
CloseScreenAnimation: None
OpenScreenAnimation: None
ShowStatusBar: Checked
TitleVisible: Checked
Main arrangement
BackgroundColor: None
Height: Fill parent
Width: Fill parent
BackgroundImage: None
Left arrangement
For images, buttons, text etc.
Height: Fill parent
Width: 60% or doing this in blocks
Right arrangement
For the simulation of Close Outside.
BackgroundColor: None
BackgroundImage: None
Height: Fill parent
Width: Fill parent
and that’s all in MIT AI2, download and save your project.apk in ..AppToMarket_v41\myApks\ folder.
AppToMarket is where the magic is created, but before we start with AppToMarket we need to create a theme and two animations, left to right and right to left, which in turn will take control over our Screen2.
Theme: mycustomtheme.xml
<?xml version="1.0" encoding="utf-8"?> <resources> <style name="Theme.myCustomTheme" parent="@android:style/Theme.Panel"> <item name="android:windowAnimationStyle">@style/myCustomAnimation.Activity</item> <item name="android:windowIsFloating">false</item> <item name="android:backgroundDimEnabled">true</item> </style> <style name="myCustomAnimation.Activity" parent="@android:style/Animation.Activity"> <item name="android:windowEnterAnimation">@anim/slide_from_left_to_right_enter</item> <item name="android:windowExitAnimation">@anim/slide_from_left_to_right_exit</item> </style> </resources>
Animation 1: slide_from_left_to_right_enter.xml
<?xml version="1.0" encoding="utf-8"?> <translate android:interpolator="@android:anim/bounce_interpolator" android:duration="600" android:fromXDelta="-100.0%" android:toXDelta="0.0%" xmlns:android="http://schemas.android.com/apk/res/android" />
Animation 2: slide_from_left_to_right_exit.xml
<?xml version="1.0" encoding="utf-8"?> <translate android:interpolator="@android:anim/linear_interpolator" android:duration="400" android:fromXDelta="0.0%" android:toXDelta="-100.0%" xmlns:android="http://schemas.android.com/apk/res/android" />
this page was very helpful in understanding the animations.
Launch your AppToMarket and browse for your project.
Decompile
Features & Update Manifest
Select necessary features and update Manifest
Screen: NoTitleBar = TitleVisible: Unchecked
Slider: Set it to Any
Edit Manifest
You’ll have to add android:theme="@style/Theme.myCustomTheme"
manually to our Screen2 in the manifest file.
<?xml version="1.0" encoding="utf-8" standalone="no"?> <!-- **** **** Generated by AppToMaret on Sat Apr 18 21:59:20 CEST 2015 **** If you wish, you can update this file to your needs. **** If updating, it has to be done prior to clicking 'Create New .apk' button AppToMarket **** However, please make sure that your updates WILL NOT break the functionality. **** For example, removing permissions, could cause runtime exceptions **** --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:installLocation="auto" android:versionName="1.0" package="appinventor.ai_bobans_s73.SideMenu"> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <supports-screens android:resizeable="false" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="false" /> <application android:debuggable="false" android:icon="@drawable/ya" android:theme="@android:style/Theme.NoTitleBar" android:label="SideMenu"> <activity android:screenOrientation="portrait" android:configChanges="keyboardHidden|orientation" android:name=".Screen1" android:windowSoftInputMode="stateHidden"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:screenOrientation="portrait" android:configChanges="keyboardHidden|orientation" android:name="appinventor.ai_bobans_s73.SideMenu.Screen2" android:theme="@style/Theme.myCustomTheme" android:windowSoftInputMode="stateHidden"> <intent-filter> <action android:name="android.intent.action.MAIN"/> </intent-filter> </activity> </application> </manifest>
Save Manifest.
and the last thing before you click the Create New.apk button
move your file mycustomtheme.xml to …AppToMarket_v41\temp_myDecompiles\res\values\ folder
move your files slide_from_left_to_right_enter.xml and slide_from_left_to_right_exit.xml to …AppToMarket_v41\temp_myDecompiles\res\anim\ folder
Create New.apk
Sign
Verify
Zip Align
Download
39 comments
Skip to comment form
very nice tanks alot
you’re welcome
This is superb..very well explained Thanks a lot.
hi
there is an error when try to install the apk file.
“There is a problem parsing the package”
kindly adv
thanks
Hi Felik,
Does it look like this as in the picture https://drive.google.com/file/d/0B0jMf5z0ndLcd3hPdDN3elBlbkE/view?usp=sharing
Hi Bobans
no it doens’t
the message is only like this:
“There is a problem parsing the package”
thanks
Sorry but I have no clue why this happens.
If you wish you may send or post a download link for your app so I can test it for myself…
It may happens if you download an app that is meant for higher android versions than yours.
That may be, but in this case he did not follow the tutorial to the end..
buddy try to remove that error with apk editor pro application u have to re-build the complete app package with apk editor pro then it will not show this type of error.
Hi Bobans, when I click Create New.Apk
This Messege
“ERROR: The new .apk was not generated due to errors”
I have the same problem
See my recent post here if it helps.
I’ll see if I can do a video tutorial….
Can you please make a video how to do it because i get an error
I have now an keystore problem
It works now
I have created the app succcesfully but if i swipe the menu dont come
Can you show me your relevant blocks for the swipe gesture…
i think i forgot the block im going to try this.
your apk also dont work
it works now
Sir I am not able to do 60% of sliding of screen2 , despite of following code properly, always 100% sliding occurs and i m not able to see that 40% portion of screen1..its important for me to do this, i have taken mit app inventor as my project, please guide me..what should i do? how i can make that 60% sliding ???
Unsure what could be causing this.
Without seeing your design, I have not much to go on.
If you can share screenshots of Screen2 for your design then maybe I can help you….
Sir, I have solved that problem, but now I am getting ERROR: “The new .apk was not generated due to errors” problem in apptomarket ! what should I
do? I have ensured that I performed all steps as per this tutorial..
This guide is somewhat old and not updated in relation to the MIT AppInventor new look, so some pictures can be misleading ….
In your case you may have missed something, see in these two threads if it might be of any help…
https://groups.google.com/d/msg/apptomarket/39ba6_p2ffA/2zmGF5RRBAAJ
https://groups.google.com/d/msg/apptomarket/PjvddHl-ZaI/dZgy9oGLBwAJ
reply soon
very nice
how you can control elements in screen 1 by buttons in screen2 ?
On Screen2 I use block “close screen with value” http://appinventor.mit.edu/explore/ai2/support/blocks/control#closescreenwithvalue
And on Screen1 block “when Screen1.OtherScreenClosed”
hello you help me a lot, can you screenshot blocks for screen one and screen two?
Thanks!
Author
If you look at the bottom of the tutorial there is a link for aia download which you can import in MIT..
to do to create a certificate on the App Market?
Howto Download Keystore from MIT AI2
menu screen not transparent to Screen 1? something I’ve done wrong? Everything compiled recompiled and completed successfully.
Author
You mean menu screen is not transparent over screen1,
if so did you copy the necessary files to the respective folder before you built the app..
Correct, trying to rebuild from scratch again tonight and will report step by step
Author
Make sure you have background color set to none for Menu Screen, Main arrangement, Right arrangement and only have background color set for the Left arrangement.
Update: Ok, Everything recompiled no errors. I think I found the initial problem. There are 3 screens to my app I placed android:theme=”…” after the Menu screen (screen 2) was placed after the Web screen (screen 3) before. Once built though and recompiled signed etc. I am getting an “app not installed” error “The package appears to be corrupt?
Update #2: Everything loaded properly once I emailed finalized zip file to myself. Last question though, is this menu only made for 2 screens? I see where you mention to use close screen in blocks. Can open screen with value also be used get an error (app stopped) when trying to open any other screen from the Menu (screen 2) screen. Would rather not rebuild if I don’t have to.
Author
Without knowing what your code looks like and what you have on screen3, hard to know why your app is crashing.
Prefer to have as few screens opened as possible at the same time (max 2 screens), I have tested to include screen3 and it works for my test app as it is lightweight app Sidemenu.aia
You have two options for opening screen3 See the link for more information App Inventor and Multiple Screens or if you download my Sidemenu.aia you can see the same thing..