I've the answer for you. You can do it both in Launcher2
and Launcher3
package from (AOSP). Jellybean is using Launcher2
may be. I personally suggest you to go with Launcher3
, it has buit-in way to do so.
Launcher3:
create a class that extends the com.android.launcher3.Launcher
class and override the necessary methods like so:
public class MyLauncher extends Launcher {
@Override
protected boolean hasCustomContentToLeft() {
return true;
}
@Override
protected void addCustomContentToLeft() {
View customView = getLayoutInflater().inflate(R.layout.custom, null);
CustomContentCallbacks callbacks = new CustomContentCallbacks() {
@Override
public void onShow() {}
@Override
public void onScrollProgressChanged(float progress) {}
@Override
public void onHide() {}
};
addToCustomContentPage(customView, callbacks, "custom view");
}
}
Here R.layout.custom
is the custom view that you wanted.
Then in the manifest file change the launcher activity class from Launcher
to MyLauncher
. And that's it.
Launcher2:
in Workspace.java
create the following method:
public void addCustomView(View child){
CellLayout layout = (CellLayout) getChildAt(0);
layout.addView(child);
}
then in Launcher.java
, find the following line:
mWorkspace = (Workspace) mDragLayer.findViewById(R.id.workspace);
then paste the following code somewhere after that line:
View child = LayoutInflater.from(this).inflate(R.layout.custom, null);
mWorkspace.addCustomView(child);