Android porting - Status Bar customization

懵懂的女人 提交于 2019-12-04 23:01:34
user637465

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);

.....
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!