安卓app调试小技巧
来源:互联网 发布:淘宝大学总裁班价格 编辑:程序博客网 时间:2024/05/21 10:18
经常为android没有好的输出用于调试信息而烦恼,有一次想应该在界面中布局一个TextVie用于调试信息输出,调试好后再删除即可,很方便。
<ImageView android:id="@+id/debug_icon" android:src="@drawable/bug" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical|right" android:layout_marginLeft="2dip" /> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:paddingRight="0dip" android:gravity="center_vertical"> <LinearLayout android:id="@+id/debug_pane" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center_vertical"> <TextView android:id="@+id/debug_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:scrollbars="vertical" android:fadeScrollbars="false" android:scrollbarStyle="outsideInset" android:minWidth="1000dp" android:maxLines="3" android:singleLine="false" style="?android:attr/textAppearanceMedium" /> </LinearLayout> </LinearLayout></LinearLayout>
static int debug_line = 1;public void debug(String text){ if(DEBUG == true){ TextView debug_window = (TextView) mFileViewListener.getViewById(R.id.debug_text); debug_window.setMovementMethod(ScrollingMovementMethod.getInstance()); //debug_window.setText(debug_window.getText() + "---" + text); debug_window.append(debug_line++ + ": "+ text + "\n"); int offset=debug_window.getLineCount()*debug_window.getLineHeight(); if(offset>debug_window.getHeight()){ debug_window.scrollTo(0,offset-debug_window.getHeight()); } }}
阅读全文
0 0
- 安卓app调试小技巧
- Android——安卓调试小技巧(一)
- 安卓APP动态调试
- 安卓开发小技巧。
- toast,小技巧,安卓
- 安卓开发小技巧
- 安卓实用小技巧:将App提取为Apk文件
- 使用调试器攻击安卓APP
- 安卓APP动态调试技术
- 安卓APP动态调试技术
- 安卓桌面小控件App Widget
- 安卓新手开发学习小技巧
- 安卓基础小技巧--(一)
- 安卓开发中的小技巧
- 安卓透明状态栏小技巧
- 安卓开发项目优化小技巧
- App推广小技巧
- 调试小技巧
- 对象赋值空指针
- win7 查看tensorBoard
- 腾讯一年感受
- tomcat优化-利用JConsole工具监控java程序内存和JVM
- 胡海泉:一颗好奇心,是我做投资的核心动力 | T-EDGE 2017
- 安卓app调试小技巧
- 徐小平讲了个投资奇迹,3年不到75万变3亿
- mark
- 连续地分解质因数
- JAVA与JAVA的发展历程
- 截图时,怎么截住右键菜单?
- 二级购物车代码逻辑分享
- Linux的7个级别
- Maven之修改WEB项目的名称-yellowcong