Android 使用LogcatView实现应用内查看上报Log

LogcatView

在这里插入图片描述

日志记录抓取

没有数据线的时候,就用这个输出日志吧

  • 使用简单,一行代码搞定
  • 点击链接可以用浏览器打开
  • 可抓取大部分Android Studio中Logcat打印的内容
  • 可以搜索内容
  • 可按tag过滤
  • 可根据日志等级筛选(提供隐藏方法)
    • A 所有内容
    • O System.out 输出的内容
    • W 警告级别的内容
    • E 错误级别的内容

集成

Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

allprojects {
    repositories {
        ...
        maven { url 'https://www.jitpack.io' }
    }
}

Step 2. Add the dependency

dependencies {
        compile 'com.github.huangdali:LogcatView:v1.1.2'
}

使用

    new LogcatDialog(this).show();

关于样式

如果你的activity继承至AppCompatActivity,请跳过此步骤】如果你的Activity不是继承至AppCompatActivity,那么样式可能会很丑,可以通过下面的设置:

1、在style.xml中定义

  <style name="Translucent_NoTitle" parent="android:style/Theme.Dialog">
        <item name="android:background">#00000000</item> <!-- 设置自定义布局的背景透明 -->
        <item name="android:windowBackground">@android:color/transparent</item>  <!-- 设置window背景透明,也就是去边框 -->
  </style>

2、设置主题

  LogcatDialog logcatDialog = new LogcatDialog(mContext,R.style.Translucent_NoTitle);
  logcatDialog.show();
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

全面解读

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值