![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
常见问题
datao819
这个作者很懒,什么都没留下…
展开
-
通过Android Layout Editor无法查看布局文件预览
问题:Eclipse中无法预览XmL布局文件。解决办法:将项目close再打开。原创 2012-03-03 15:30:43 · 3626 阅读 · 2 评论 -
修改Eclipse自动换行长度
原因:使用Ctrl+Shift+F自动格式化代码的时候,有时候折行太多反而让代码看起来更乱,不容易阅读。解决办法:Window-->Preferences-->Java-->Code Style-->Formatter-->Edit-->Line Wrapping-->Maximum line width一般设置120以上原创 2012-06-07 11:24:18 · 13953 阅读 · 0 评论 -
Eclipse 3.7 中文字体太小
原因:Eclipse 3.7 在 Windows 7 下的默认字体改变,从“Courier New”字体改为“Consolas”。解决办法:Window --> Preferences-->General --> Appearance --> Colors and Fonts”,打开 “basic --> Text Font” ,Edit或者双击,将字体改成 Courier New原创 2012-05-16 17:21:59 · 669 阅读 · 0 评论 -
intent指定使用Google Map打开地图
问题描述:使用Intent调用地图功能时,强制使用Google Map打开解决方法:Intent intent = new Intent(Intent.ACTION_VIEW, uri);intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActi原创 2012-03-22 11:49:28 · 1359 阅读 · 0 评论 -
自定义ListView无法响应点击事件
问题描述:自定义的ListView无法触发OnItemClickListener。解决方法:对Item Layout的根控件设置其android:descendantFocusability="blocksDescendants"即可。原创 2012-03-22 11:29:05 · 2647 阅读 · 1 评论 -
去除GridView选中时的黄色背景
问题描述:如何去除GridView选中时的黄色背景?解决办法:android:listSelector="#00000000"或者:android:listSelector="@android:color/transparent"注意:有些情况下,采用第一种方法没有效果,感觉和具体的设备有关系。原创 2012-03-21 16:41:47 · 5710 阅读 · 0 评论 -
去除ListView选中时的黄色背景
问题描述:如何去除ListView选中时的黄色背景?解决办法:android:listSelector="#00000000"或者:android:listSelector="@android:color/transparent"原创 2012-03-21 16:34:27 · 5940 阅读 · 0 评论 -
onFling()和onSingleTapUp()方法无法触发
问题描述:GestureDetector的onFling()和onSingleTapUp()方法无法触发。解决办法:onDown方法return了false,导致依赖于onDown的onFling()和onSingleTapUp()方法无法被触发。return true即可。注意:event监听方法返回true还是false是很有讲究的,多个even原创 2012-03-21 15:56:10 · 9954 阅读 · 1 评论 -
ListView滑动时变黑
问题描述:如何解决ListView滑动时变黑的问题?解决办法:android:cacheColorHint="#00000000"或者android:cacheColorHint="@android:color/transparent"原创 2012-03-21 16:36:54 · 813 阅读 · 0 评论 -
Finalizing a Cursor that has not been deactivated or closed
问题描述:使用Sqlite数据库时,有时候会报下面的异常:Finalizing a Cursor that has not been deactivated or closed。一个光标没有被停用或者关闭。解决方法:在使用Cursor对象前,调用startManagingCursor()方法,让Activity基于本身的生命周期,来管理Cursor的生命周期。原创 2012-03-28 15:17:00 · 3329 阅读 · 0 评论 -
Socket中文乱码问题
问题描述:在使用Socket时,经常会遇到中文显示乱码问题。解决方法:1.用PrintWriter来向socket写数据时,创建OutputStreamWriter时带上编码类型: //写socketOutputStream outputToSocket = socket.getOutputStream();PrintWriter streamWriter = new原创 2012-03-27 11:50:57 · 12120 阅读 · 0 评论 -
xml文件中不能使用&符号
问题:定义android 的string.xml 文件时,不能使用&符号。解决办法:在需要使用&符号的位置,采用&代替。原创 2012-03-03 15:37:37 · 4743 阅读 · 0 评论 -
导入项目乱码问题
1.项目 右击——>Properties——>Resource——>Text file encoding 改为 UTF-8。2.在文件目录中 使用工具编辑文件,比如NotePad++,复制文件内容,格式——>转为 UTF-8 格式编码,粘贴,并保存。原创 2012-03-03 15:22:10 · 369 阅读 · 0 评论 -
eclipse乱码问题
修改eclipse的编码格式:1.菜单 Window——>Preferences——>General——>Workspace——>Text file encoding 改为 UTF-8。2.项目 右击——>Properties——>Resource——>Text file encoding 改为 UTF-8。3.单个文件 右击——>Properties——>Resource——>Tex原创 2012-03-03 15:21:42 · 351 阅读 · 0 评论 -
图片资源中总会出现thumb.db文件
问题描述:一般图片资源都会存储在drawable文件夹中,有时候我们需要查看图片的大小等属性。需要进入图片目录,这时候Windows会自动生成一个thumb.db文件,而drawable文件夹中是不允许存储此类文件的。这就导致报错。解决办法:工具——>文件夹选项——>查看——>不缓存缩略图原创 2012-03-03 15:25:10 · 5932 阅读 · 0 评论 -
setClickable(false)不起作用
问题:设置一个控件的setClickable(false)后,发现没有效果。解决办法:setClickable(false)方法一定要在setOnClickListener()方法之后。因为在setOnClickListener()方法中有这样一段代码: if (!isClickable()) { setClickable(true); }原创 2012-06-07 11:29:41 · 15037 阅读 · 3 评论