AriesHoo / UIWidget

一个集成TabLayout、UIAlertDialog、UIActionSheetDialog、UIProgressDialog、TitleBarView(自带沉浸式标题栏)、CollapsingTitleBarLayout、RadiusView(圆角及状态背景设置View解放shape文件)、KeyboardHelper(软键盘控制及遮挡控制类)、StatusViewHelper(状态栏沉浸帮助类)、NavigationViewHelper(导航栏沉浸式帮助类)、AlphaViewHelper(View透明度控制帮助类) 等项目常用UI库
Apache License 2.0
424 stars 74 forks source link

vivox7 (Android 5.1)状态栏无法使用黑色文字,没有找到相关api #32

Closed AndMy closed 5 years ago

AndMy commented 5 years ago

vivox7 沉浸模式不管用 image

image

AriesHoo commented 5 years ago

你单独使用我的demo可以么?

AndMy commented 5 years ago

手机不在我身边,但是公司的测试机都没问题,同样的app

AriesHoo commented 5 years ago

如果使用我的demo没有问题就检查下自己的项目中是否使用了fitsSystemWindows 属性,这个属性不能设置true不然系统会自动预留出状态栏的高度的,检查下xml及java代码

AndMy commented 5 years ago

没有设置那个属性,刚刚全局搜了没搜到,下面是正常的(华为手机),没有“预留出状态栏的高度的”,因为我把上面的高度设置的高 image

AriesHoo commented 5 years ago

你这个标题栏本来就设置了这么高么?我看vivo和华为的高度差不多,只是状态栏文字颜色vivo是白色的,vivo没有找到api设置黑色文字的,你这个手机是android5.0的android6.0原生支持状态黑色文字的。如果你说的沉浸式失败是说的状态栏文字颜色的话

AndMy commented 5 years ago

对状态栏暗色字体颜色,失败了

AriesHoo commented 5 years ago

这个我暂时也没有找到vivo官方的api,这个手机是Android 6.0以下的版本,没法设置状态栏黑色文字

AndMy commented 5 years ago

这个我暂时也没有找到vivo官方的api,这个手机是Android 6.0以下的版本,没法设置状态栏黑色文字

好的,我找找这个手机

AriesHoo commented 5 years ago

我咨询过Vivo官方技术的。这个api不对普通应用提供。系统对状态栏背景颜色做了监控自己会根据背景色决定使用黑色还是白色背景,目前这个库将背景色设置为透明的。故文字颜色会为白色。且现在系统版本升级还是很快的

AndMy commented 5 years ago

那我把titlebar的背景设置白色就可以了?明天试试

---原始邮件--- 发件人: "Aries Hoo²⁰¹⁹"notifications@github.com 发送时间: 2019年7月16日(星期二) 上午8:46 收件人: "AriesHoo/UIWidget"UIWidget@noreply.github.com; 抄送: "恰好你来"876686355@qq.com;"Author"author@noreply.github.com; 主题: Re: [AriesHoo/UIWidget] vivox7 (Android 5.1)状态栏无法使用黑色文字,没有找到相关api (#32)

我咨询过Vivo官方技术的。这个api不对普通应用提供。系统对状态栏背景颜色做了监控自己会根据背景色决定使用黑色还是白色背景,目前这个库将背景色设置为透明的。故文字颜色会为白色。且现在系统版本升级还是很快的

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

AriesHoo commented 5 years ago

他是那么回复我的我今天早上在云手机上测试没有效果。还是建议使用半透明的算了

AndMy commented 5 years ago

那个手机,今天给我反馈了,只有首页状态栏白色,然后二级界面是暗色(应该是正常的),我在首页又调用了一次黑色字体的那个方法,还是不行

那现在我这边设置titlebar半透明背景?

---原始邮件--- 发件人: "Aries Hoo²⁰¹⁹"notifications@github.com 发送时间: 2019年7月16日(星期二) 晚上10:27 收件人: "AriesHoo/UIWidget"UIWidget@noreply.github.com; 抄送: "恰好你来"876686355@qq.com;"Author"author@noreply.github.com; 主题: Re: [AriesHoo/UIWidget] vivox7 (Android 5.1)状态栏无法使用黑色文字,没有找到相关api (#32)

他是那么回复我的我今天早上在云手机上测试没有效果。还是建议使用半透明的算了 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

AriesHoo commented 5 years ago

我是建议设置半透明的发自我的华为手机

AndMy commented 5 years ago

我是建议设置半透明的发自我的华为手机

是的,设置半透明就好了, image

还有一个问题关于radiusview的 有个属性setBackgroundSelectedColor,我在xml里设置 rv_selected="true" rv_backgroundSelectedColor="#4E7BFA" rv_backgroundColor="@color/white" 然后在adapter里这样使用的 image貌似不管用,必要要用代码设置一次helper.rtv_submitRadius.getDelegate().setSelected(true);这个才管用

不知道是我使用的方式不对,请大佬教教我

AriesHoo commented 5 years ago

你使用的哪个版本?理论上直接xml设置就可达到效果的。我这个功能一直在使用的 image image image

AndMy commented 5 years ago

最新版本,我在recycleview的item里用的 rv_selected="true" rv_backgroundSelectedColor="#4E7BFA" rv_backgroundColor="@color/white", 然后在adapter里直接用 if(true){ helper.rtv_submitRadius.getDelegate().setSelected(true); }else{ helper.rtv_submitRadius.getDelegate().setSelected(false); } 没效果

AriesHoo commented 5 years ago

这个RadiusView的完整xml复制一下

AndMy commented 5 years ago

我就用了这三个,外加一个圆角属性

AriesHoo commented 5 years ago

按道理你应该和我这个差不多,不清楚你那边的具体情况。是预览没有效果还是运行没有效果 rtv_submitRadius直接调用View的setSelected方法就好,这个处理是写在控件里面的

image

image

预览和直接运行都是正常的,库版本为3.2.15

AndMy commented 5 years ago

预览效果倒是有,就recycleview里数据有多条,item用到的是RadiusTextView,然后设置那几个属性,然后直接在adapter里直接根据条件去设置setSelected(true)和setSelected(false),这个是我几天前试的,当天没效果,然后就用helper.rtv_submitRadius.getDelegate().setSelected(true)和helper.rtv_submitRadius.getDelegate().setBackgroundSelectedColor(item.follow?Color.parseColor("#CCCCCC"):Color.parseColor("#4E7AF7"));这个的组合才管用

有时间我在试试

AndMy commented 5 years ago

这个RadiusView的完整xml复制一下

我来复现一下这个问题(是因为我用的方式不对?) 这是xml布局及属性,下图 image

java代码 image

image 最终效果图,如下 image

AriesHoo commented 5 years ago

image

image

请先确定是否使用最新版本库(3.2.15),虽然感觉和库没太大关系,因为挺久没有更新过这块内容了。Android Studio及gradle 是否升级最新。

使用View.setSelected方法,确实使用getDelegate代理方法里的setSelected确实是没有效果得,我最近版本会修改

AndMy commented 5 years ago

image

image

请先确定是否使用最新版本库(3.2.15),虽然感觉和库没太大关系,因为挺久没有更新过这块内容了。Android Studio及gradle 是否升级最新。

使用View.setSelected方法,确实使用getDelegate代理方法里的setSelected确实是没有效果得,我最近版本会修改

gradle版本不是最新的 是 4.4 android-studio3.4.1.0 库版本 com.github.AriesHoo.UIWidget:widget-core:3.2.14

AriesHoo commented 5 years ago

没事。使用View.setSelected方法 即可 image

AndMy commented 5 years ago

好的,谢谢了