parcool 2013-01-19
方法一:初始化的时候在代码里面设置
gridView.setSelector(new ColorDrawable(Color.TRANSPARENT));
方法二:
<GridView android:id="@+id/all_apps"
android:background="@drawable/application_background"
android:persistentDrawingCache="animation|scrolling"
android:alwaysDrawnWithCache="true"
android:scrollbars="none"
android:drawSelectorOnTop="false"
android:listSelector="@drawable/grid_selector"
android:numColumns="auto_fit"
android:columnwidth="78dp"
android:stretchMode="spacingWidth"
android:layout_weight="1.0"
android:layout_height="0dip"
android:layout_width="match_parent"
android:stackFromBottom="true"
android:visibility="invisible"
/>
在GridView属性中注意上面绿色的那一行.它指定了元素的背景布局文件为dwawable目录下面的grid_selector.xml文件.打开grid_selector.xml文件,有下面的描述: