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

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

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

赞 (0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • php注册登录页面完整代码_用户登录注册代码

    php注册登录页面完整代码_用户登录注册代码先看演示~示例图:Ps.本人有点懒哈~就输出个成功算了吧~PHP实现登录注册index.php(首页)login.php(登录)register.php(注册)代码里面注释写很详细了哦~废话不多说直接上代码~index.php代码:<!DOCTYPEhtml><html><head><metacharset=”utf-8″><metaname=”viewport”content=”width=

    2022年10月3日
  • ORACLE sqlplus连接报ORA-12560解决办法

    ORACLE sqlplus连接报ORA-12560解决办法在windows服务器上cmdsqlplus用户名/密码连接报ORA-12560(协议适配器错误啥的)解决办法如下:1.再原命令上增加@127.0.0.1/实例sqlplus用户名/密码@127.0.0.1/实例assysdba(assysdba可不加)尝试是否能连接。若不能试试cmd打开后先setoracle_sid=实例再…

    2022年7月16日
  • px像素和dp像素密度区别[通俗易懂]

    px像素和dp像素密度区别[通俗易懂]px即像素,1px代表屏幕上一物理像素点。dp(dip)Densityindependentpixels.设备无关像素,与像素密度相关。像素密度:每英寸包涵的像素数

    2022年5月25日
  • 对不起,学会这些 Linux 知识后,我有点飘

    对不起,学会这些 Linux 知识后,我有点飘Linux简介UNIX是一个交互式系统,用于同时处理多进程和多用户同时在线。为什么要说UNIX,那是因为Linux是由UNIX发展而来的,UNIX是由程序员设计,它的主要服务对象也是程序员。Linux继承了UNIX的设计目标。从智能手机到汽车,超级计算机和家用电器,从家用台式机到企业服务器,Linux操作系统无处不在。大多数程序员都喜欢让系统尽量简单,优雅并具有一致性。举个例子,从最底层的角度来讲,一个文件应该只是一个字节集合。为了实现顺序存取、随机存取、按键存取、远程存取只能是

    2022年5月31日
  • Java——你真的了解Java异常处理机制吗?[通俗易懂]

    Java——你真的了解Java异常处理机制吗?[通俗易懂]你真的了解java异常处理吗?

    2022年5月19日
  • html页面根据js名称调用需要的js

    html页面根据js名称调用需要的js

    2021年8月9日

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

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