android gridview控件使用详解_android tablelayout

android gridview控件使用详解_android tablelayoutfrom:http://blog.csdn.net/weich_java/article/details/6987198笔者在用GridView时发现GridView的selectstyle会根据系统而不同,因为在客户端中一边具有统一的显示风格,所以尝试了下指定GridView的选中样式。首先看一下代码:menu.xmlandroid:layout_width=”fill_parent”andr…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE稳定放心使用

from:http://blog.csdn.net/weich_java/article/details/6987198

笔者在用GridView时发现GridView的select style会根据系统而不同,因为在客户端中一边具有统一的显示风格,所以尝试了下指定GridView的选中样式。

首先看一下代码:

menu.xml

android:layout_width=”fill_parent”

android:layout_height=”fill_parent”

android:background=”#e1e7e8″

android:orientation=”vertical”>

android:id=”@+id/menu”android:layout_width=”fill_parent”android:layout_marginTop=”10dip”

android:layout_height=”fill_parent”android:numColumns=”auto_fit”

android:verticalSpacing=”10dp”android:horizontalSpacing=”10dp”

android:columnWidth=”90dp”android:stretchMode=”columnWidth”

android:gravity=”center”>

其中android:listSelector=”#e1e7e8″这句,android:listSelector的颜色值一定要和它父类容器的背景色相同,这样就不会出现选中时的黑色。

menuitem.xml

android:layout_height=”wrap_content”

android:paddingBottom=”4dip”

android:background=”@drawable/bg_alibuymenu_states”

android:layout_width=”fill_parent”>

android:id=”@+id/ItemImage”

android:layout_marginTop=”20dip”

android:layout_width=”wrap_content”

android:layout_centerHorizontal=”true”>

android:gravity=”center”

android:textColor=”@color/text_color”

android:singleLine=”true”

android:textSize=”16dip”

android:layout_below=”@+id/ItemImage”

android:layout_height=”wrap_content”

android:layout_centerHorizontal=”true”

android:id=”@+id/ItemText”>

android:background=”@drawable/bg_alibuymenu_states”这句话指定了 GridView中的元素的背景风格。

bg_alibuymenu_states.xml

在此文件中也可设置default的样式,如果需要的话。

bg_alibuybutton_selected.xml

android:endColor=”@color/button_selected_end_color”android:type=”linear”

android:angle=”90″android:centerX=”0.5″android:centerY=”0.5″/>

bg_alibuybutton_default.xml

android:endColor=”@color/button_defalut_end_color”android:type=”linear”

android:angle=”90″android:centerX=”0.5″android:centerY=”0.5″/>

0_13220101349UKC.gif

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/189770.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)
blank

相关推荐

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号