Android Log工具
Android标准的Api中Log.i打印输出的控制台。本示例基于装饰模式,扩展了Log的功能,能将打印信息到LogView中。
本示例库已经支持jcenter的引入
compile 'com.jackyang.main.test:logView:1.4.0'
功能
- 双击清除log
- 滑动最上,最下
- 自动滑动
使用
- in the layout add FrameLayout with id framelog.
<FrameLayout
android:id="@id/framelog"
android:layout_width="match_parent"
android:layout_height="match_parent"></FrameLayout>
- inject the Fragment in java.
final android.support.v4.app.FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
final LogFragment fragment = new LogFragment();
transaction.replace(R.id.framelog, fragment);
- When get focus inject LogView to LogWrapper
LogFragment fragment = (LogFragment) getSupportFragmentManager().findFragmentById(R.id.framelog);
LogCatWrapper logcat = new LogCatWrapper();
logcat.setNext(fragment.getLogView()); //wait unit the fragment has getFocus
Log.setLogNode(logcat);
- use log
com.jack.test.logger.Logger.d(...)