我想在一个BroadcastReceiver内部启动Service.我想要做的是有一个后台运行service,收集传入的短信,并记录来电.我认为最好的解决方法是service运行一个包含可以编目的广播接收器.
我该怎么做呢?我已经启动并运行了我的服务.
我正在尝试将状态栏的颜色更改为带有灰色图标的白色.我已经为这个问题尝试了几乎所有的代码解决方案,但是没有为我工作.
我正在使用这个java fucntion来改变它,我也发布了我的样式(21)代码.
public static void statusBarColor(Window window, Context ctx) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
//Window window = getActivity().getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.setStatusBarColor(ctx.getResources().getColor(R.color.statusbar_color));
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的java代码,但它在千万次尝试后无法正常工作.以下是我的style.xml(21)
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar" tools:targetApi="23">true</item>
</style>
Run Code Online (Sandbox Code Playgroud)
如果你认为它的一些其他问题的副本,那么我现在应该让你尝试3,4页谷歌搜索并实施它们.
android statusbar android-layout android-view material-design