---
title: "Android调试问题集锦"
author: "zjsrustar"
date: "2012-08-09T15:33:17Z"
tags: []
categories: ["移动开发"]
slug: "android"
draft: false
lastmod: "2012-07-31T23:35:03Z"
id: 1613352
url: "https://zjsrustar.iteye.com/blog/1613352"
---

本文用以记录调试过程中遇到的各种问题及解答方案。

 

Q1:android中的空格编码 string.xml前后加空格的技巧?

Desc：在类似TextView等的View中用android:text="测试     文字"的时候（硬编码），可以正常显示正确的空格数；但是如果使用资源文件android:text="@string/test\_word"的时候，不管我资源文件里面

&lt;string name="test\_word"&gt;测试         文字&lt;/string&gt;

中间使用多少个空格，或者TAB。在模拟器上运行的时候，N个空格都只显示一个。

A：使用全角空格。用途：估计只有在设计登陆框的时候。

 

Q2:Android LogCat显示和过滤器添加 logcat 查看system.out 的信息？

A2：

1\. 打开Window -&gt; Show View -&gt; Other -&gt;Android -&gt; LogCat,然后选择确定即可；

2\. 然后再下面的LogCat窗口中点击+号的图标，来创建过滤器。如要显示System.out输出的信息时，可以

在Filter Name处任意写个名字，在By Log Tag处写上System.out其他的默认即可。