Android分享对话框实现,Android7.0之后状态栏着色解决——主题(Theme)的正确玩法

现象

根本原因是BaseActivity基类中,进行了状态栏着色,代码如下: 继续阅读“Android分享对话框实现,Android7.0之后状态栏着色解决——主题(Theme)的正确玩法”

微信、支付宝、手机QQ等自带浏览器环境内左上角返回、关闭按钮事件监控及处理方法

最靠谱的方式是通过JS监控popstate事件,然后进行相应的处理。核心代码如下:

if (window.history && window.history.pushState) {
    //document.addEventListener('visibilitychange', function() {
    //    alert(document.visibilityState);
    //}, false);
    //window.on('popstate', function() {
    //    alert("我监听到了浏览器的popstate");
    //});
    //window.onpopstate = function(e) {
    //    console.log(e.state);
    //
    //};
    $$(window).on('popstate', function() {  // 返回按钮
        var hashLocation = location.hash;   // 获取或设置页面的标签值
        console.log("popstate");
        console.log("hashLocation:"+hashLocation);
        var hashSplit = hashLocation.split("#!/");
        var hashName = hashSplit[1];
        console.log("hashName:"+hashLocation);
        if (hashName !== '') {
            var hash = window.location.hash;    // 获取或设置页面的标签值
            console.log("hash:"+hash);
            if (hash === '') {
                alert('再次点击返回按钮退出程序');
            }
        }
    });
    console.log("pushstate");
    var url = window.location.href;
    var timestamp = new Date().getTime();

    if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
        window.history.pushState('forward', null, './#forward');
    } else {
        window.history.pushState('', "大糖医", url+"#"+timestamp); // 状态对象、标题(现在会被忽略),可选的URL地址。
    }
}

继续阅读“微信、支付宝、手机QQ等自带浏览器环境内左上角返回、关闭按钮事件监控及处理方法”

css实现文本两行或多行文本溢出显示省略号

css实现文本两行或多行文本溢出显示省略号,这个方法不兼容ie。

<style>
.comment_inner{
    width: 200px;
    word-break: break-all;
    text-overflow: ellipsis;
    display: -webkit-box; /** 对象作为伸缩盒子模型显示 **/
    -webkit-box-orient: vertical; /** 设置或检索伸缩盒对象的子元素的排列方式 **/
    -webkit-line-clamp: 3; /** 显示的行数 **/
    overflow: hidden; /** 隐藏超出的内容 **/
}
</style>

word-break 属性规定自动换行的处理方法。normal(使用浏览器默认的换行规则。),break-all(允许在单词内换行。),keep-all(只能在半角空格或连字符处换行。)

CentOS7安装配置sendmail汇总——仍然没有配置成功

1. CentOS 7 默认安装了sendmail,直接命令行可以运行。

which sendmail,如下:
/usr/sbin/sendmail
关闭IPV6(默认是开启的,IPV4和IPv6的地址不一样,关闭后记得检查IP地址)
sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w net.ipv6.conf.default.disable_ipv6=1

继续阅读“CentOS7安装配置sendmail汇总——仍然没有配置成功”