原创 android logcat鼠標懸浮提示過快

通過修改註冊表設置響應時間: 找到 HKEY_CURRENT_USER\Control Panel\Mouse, MouseHoverTime項 修改它的值爲600 如果沒有就新建一個字符串值, 並設置它的值。

原创 去除GridView選中時的黃色背景

問題描述: 如何去除GridView選中時的黃色背景? 解決辦法: android:listSelector="#00000000" 或者:android:listSelector="@android:color/transparent

原创 通過Android Layout Editor無法查看佈局文件預覽

問題: Eclipse中無法預覽XmL佈局文件。 解決辦法: 將項目close再打開。

原创 多屏幕支持

如何支持多種屏幕大小? 基本概念: 屏幕大小 指的是屏幕的物理大小,分爲四類:small, normal, large, and extra large。屏幕密度(dpi) 每英寸點數,指的是屏幕一定物理區域內像素數量。分辨率 屏幕上的物

原创 Bitmap Outofmemory問題

問題描述: 操作Bitmap時,經常會遇到 Outofmemory的錯誤,如何解決? 解決方法: 1.通過option的inSampleSize縮放圖片,減小圖片尺寸。 2.設置option的inPurgeable爲true,讓系統在內

原创 自定義ListView無法響應點擊事件

問題描述: 自定義的ListView無法觸發OnItemClickListener。 解決方法: 對Item Layout的根控件設置其android:descendantFocusability="blocksDescendants"

原创 聯網判斷

判斷聯網代碼: ConnectivityManager cManager=(ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo i

原创 從resource中獲得Drawable

從resource中獲得Drawable的方法: Resources res = getResources(); Drawable drawable=res.getDrawable(id);//id爲R.drawable.圖片名稱

原创 GridView邊框效果

爲GridView添加邊框效果 1.自定義GridView的item樣式: grid_item.xml文件 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:andro

原创 SoundPool控制音量大小

通過音量加減鍵控制SoundPool音量大小: SoundPool soundPool = new SoundPool(1, AudioManager.STREAM_MUSIC, 0); 點贊 收藏 分享

原创 xml文件中不能使用&符號

問題: 定義android 的string.xml 文件時,不能使用&符號。 解決辦法: 在需要使用&符號的位置,採用 &amp; 代替。 點贊 收藏 分享 文章舉報 dat

原创 Gallery去除慣性、半屏翻頁

問題描述: 有時候,我們不需要Gallery的慣性,如何去掉Gallery的慣性? 解決方法: 通過繼承Gallery,並重寫一些方法,自定義Gallery特性。 import android.content.Context; imp

原创 按鈕點擊效果

實現button的點擊效果: 定義button的背景文件button_bg.xml,放在drawable文件夾下。 <?xml version="1.0" encoding="utf-8"?> <selector xmlns:andro

原创 No resource found android:WindowTitleBackground

自定義style時: <style name="iWindowTitleBackground" parent="android:WindowTitleBackground"> <item name="android:b

原创 ListView滑動時變黑

問題描述: 如何解決ListView滑動時變黑的問題? 解決辦法: android:cacheColorHint="#00000000" 或者 android:cacheColorHint="@android:color/transpar