我使用SlidingMenu来实现我的滑入式菜单.
代码是
Run Code Online (Sandbox Code Playgroud)private void initSlidingMenu() { // configure the SlidingMenu menu = new SlidingMenu(this); menu.setMode(SlidingMenu.LEFT); menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN); menu.setShadowWidthRes(R.dimen.shadow_width); // menu.setShadowDrawable(R.drawable.shadoew); menu.setBehindOffsetRes(R.dimen.slidingmenu_offset); // menu.setFadeDegree(0.35f); menu.attachToActivity(this, SlidingMenu.SLIDING_WINDOW); menu.setMenu(R.layout.menu_main_sliding); }
然后我遇到的问题是导航栏背后的布局.


我将SlidingMenu.SLIDING_WINDOW更改为SlidingMenu.SLIDING_CONTENT.这是有效的,但动作栏总是在顶部.
看看SlidingMenu的源代码,我找到这个代码来添加slidemenu.
switch (slideStyle) {
case SLIDING_WINDOW:
mActionbarOverlay = false;
ViewGroup decor = (ViewGroup) activity.getWindow().getDecorView();
ViewGroup decorChild = (ViewGroup) decor.getChildAt(0);
// save ActionBar themes that have transparent assets
decorChild.setBackgroundResource(background);
decor.removeView(decorChild);
decor.addView(this);
setContent(decorChild);
break;
case SLIDING_CONTENT:
mActionbarOverlay = actionbarOverlay;
// take the above view out of
ViewGroup contentParent = (ViewGroup)activity.findViewById(android.R.id.content);
View content …Run Code Online (Sandbox Code Playgroud) 我想得到drawable的边界,但后来我使用getBounds或copyBounds方法.他们都返回Rect(0,0 - 0,0).像这样的代码
Drawable marker = getResources().getDrawable(
R.drawable.tbar_single_pressed);
Rect copyRect = marker.copyBounds();
Rect getRect= marker.getBounds();
Run Code Online (Sandbox Code Playgroud)
那么结果copyRect是Rect(0,0 - 0,0)getRect也是Rect(0,0 - 0,0)
为什么?标记是非null,我有res tbar_single_pressed ....
谢谢
该应用程序有一个BroadcastReceiver,它侦听启动完成事件并启动后台服务以将一些数据发送到我的HTTP服务器.
我的问题是,如果应用程序从未由用户运行(仅安装),则BroadcastReceiver是否会收到引导事件?