我用Lg Q6。版本7.1.1。导航栏颜色不会随着下面的代码而改变。我尝试动态更改并使用主题,但没有任何变化。我不明白我在哪里做错了什么?
首先以编程方式尝试
WITH
然后尝试style.xml
Manifest.xml
alter session set nls_date_format = 'dd/mm/yyyy';
with
test_data (sr_no, name, status, dt) as (
select 121, 'HP' , 'OK' , to_date('12/06/2018') from dual union all
select 122, 'Dell' , 'OK' , to_date('15/06/2018') from dual union all
select 123, 'MAC' , 'NOK', to_date('30/07/2018') from dual union all
select 124, 'Apple', 'NOK', to_date('03/09/2018') from dual union all
select 125, 'MI' , 'NOK', to_date('04/09/2018') from dual union all
select 126, 'Oppo' , 'NOK', to_date('05/09/2018') from dual union all
select 127, 'Vivo' , 'OK' , to_date('06/09/2018') from dual
)
select case grouping_id(flag) when 0
then case flag when 'b' then 'Till 30th July'
else 'After 30th July'
end
else 'Total'
end as category
, count(status) as ct
, count(case status when 'OK' then 0 end) as ok
, count(case status when 'NOK' then 0 end) as nok
from ( select sr_no, name, status, dt,
case when dt <= date '2018-07-30' then 'b' end as flag
from test_data
)
group by rollup(flag)
order by grouping_id(flag), flag
;
CATEGORY CT OK NOK
--------------- ---------- ---------- ----------
Till 30th July 3 2 1
After 30th July 4 1 3
Total 7 3 4
style.xml
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setNavigationBarColor(getResources().getColor(R.color.your_awesome_color));
}
答案 0 :(得分:0)
每次您要在整个应用程序中更改评论或项目的颜色时,最好在其中添加特殊样式并将其引入程序的原始样式。
例如:如果要更改底部导航栏的背景,则可以在style.xml v21中的行下添加:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:navigationBarColor">@color/colorAccent</item>
</style>
但是如果要更改工具栏的背景颜色,则应为其定义样式,例如:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
.
.
.
<item name="toolbarStyle">@style/MyStyle</item>
</style>
<style name="MyStyle" parent="Theme.AppCompat.Light">
<item name="android:background">#024dfc</item>
</style>
您可以使用这种方式为您的应用定义夜间和白天主题。 希望您喜欢。