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)
上一篇 2026年3月9日 上午7:22
下一篇 2026年3月9日 上午8:01


相关推荐

  • 初级程序员面试题总结(一):

    本人将这几天面试的题目总结一些,如果出现错误请指正,谢谢。1,谈一谈spring。答:spring是为java程序开发提供的综合性的基础java开发平台,它提供了从表现层SpringMVC到业务层Spring再到持久层springData的一套完整的解决方案。spring的核心有两大块,第一块是AOP,面向切面编程,它将程序与业务分离,集中来解决一些公共问题。第二块是IOC,控制反转,由容…

    2022年4月8日
    59
  • python的遍历字符串的方式

    python的遍历字符串的方式1)直接进行遍历strs=’abcd’forchinstrs:print(ch)2)利用下标遍历strs=’abcd’forindex,chinenumerate(strs):print(index,end=”)print(ch)3)利用range进行遍历strs=’abcd’forindexin…

    2022年6月22日
    57
  • Centos Go环境搭建「建议收藏」

    Centos Go环境搭建「建议收藏」标准官网:https://golang.org/需要墙镜像官网:https://golang.google.cn/dl/【国内推荐】1、下载文件wgethttps://golang.google.cn/dl/go1.14.7.linux-amd64.tar.gz2、解压文件到/usr/local如果之前已经安装过go的版本,先清空下go下面src,不然可能会报一些previousdeclarationat/usr/local/go/src/runtime/internal/atom

    2022年10月12日
    6
  • C++ 实现图片base64编解码

    C++ 实现图片base64编解码最近使用人脸识别 restfulAPI 遇到了要求图片 base64 编码后传输问题 借此机会了解下什么是 base64 编码 部分内容参考自阮一峰 blog http www ruanyifeng com blog 2008 06 base64 html1 什么是 base64 编码所谓 Base64 就是说选出 64 个字符 小写字母 a z 大写字母 A Z 数字 0 9 符号 再加上作为垫字的

    2026年3月20日
    2
  • 深入理解无锁编程「建议收藏」

    深入理解无锁编程「建议收藏」hi,大伙好,今天介绍一下无锁编程基础知识,希望大家可以了解无锁编程基本原理。无锁编程是一个挑战,不仅因为任务本身的复杂性,还因为从一开始就很难深入了解这个主题,因为该主题和底层技术(编译…

    2022年6月10日
    33
  • SPPNet网络模型[通俗易懂]

    SPPNet网络模型[通俗易懂]上篇文章详细阐述了R-CNN网络模型,本篇本章本来准备阐述Fast-RCNN模型的,介于SPP-Net模型有许多技巧性的技术可以在不同模型上使用,所以本篇详细分析下SPP-NetSPPNet论文:https://arxiv.org/abs/1406.4729SPPNet论文翻译:https://blog.csdn.net/mengduan…

    2022年6月9日
    29

发表回复

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

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