Android porting - Status Bar customization
Hi I am trying to modify the statusbar icon in android. The file, statusbar_background.9.png is to modified. 1. But could some one suggest me how to make it transparent? As for the customization, can we resize status bar width to a relative size? means,based on number of icons present on the screen? I am modifying the file /frameworks/base/packages/systemui/src/com/android/systemui/statusbar/statusbarservice.java
Please give me some suggest开发者_JS百科ion Thanks Ab
Finally I found the answer for my question.
I changed the following:
android:background="@drawable/statusbar_background"
to
android:background="@android:color/transparent"
inside the /framework/base/packages/systemui/res/statusbar.xml
file.
For resizing the status bar need to do the following:
modify the protected void addStatusBarView()
function in StatusbarService.java
file with the following:
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
//abhi 17 mar ViewGroup.LayoutParams.MATCH_PARENT,
mwidth, //specify the width of statusbar..
height,
WindowManager.LayoutParams.TYPE_STATUS_BAR,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING,
PixelFormat.TRANSPARENT
);
// abhi 15 march lp.gravity = Gravity.TOP | Gravity.FILL_HORIZONTAL;
lp.gravity = Gravity.TOP | Gravity.LEFT;
lp.setTitle("StatusBar");
//lp.gravity = Gravity.CENTER;//abhi 18 march
lp.windowAnimations = com.android.internal.R.style.Animation_StatusBar;
lp.x = 25; // to move status bar to x position
WindowManagerImpl.getDefault().addView(view, lp);
.....
}
精彩评论