为了更好地用户体验, 当用户点击的时候, 要给用户feedback, 在一个布局中, 点击的时候背景颜色改变, 但我们有时候又没有专门的设计人员,这时候就自己了.如下图:

点击的时候颜色会改变

布局的代码如下

android:orientation="horizontal"

//这里的background下面会说到

android:background="@drawable/layout_white_background"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:clickable="true"

>

android:textSize="16.0sp"

android:textColor="@color/text_light"

android:gravity="center"

android:layout_gravity="top"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_marginLeft="10.0dip"

android:layout_marginTop="10.0dip"

android:text="签 名" />

android:textColor="@color/text_light"

android:gravity="left"

android:layout_width="0.0dip"

android:layout_height="wrap_content"

android:layout_marginLeft="3.0dip"

android:layout_weight="1.0" />

android:id="@+id/layout_description_more"

android:paddingLeft="5.0dip"

android:layout_width="30.0dip"

android:layout_height="45.0dip">

android:layout_gravity="left|center"

android:layout_width="10.0dip"

android:layout_height="10.0dip"

android:src="@drawable/arrow"

/>

上面中最主要的就是LinearLayout的background, 这里说了点击的时候的背景是什么

xmlns:android="http://schemas.android.com/apk/res/android">

//上面的

//color/lilayout_dark是在colors.xml中定义了的

#fff4f4f4

//color/layout_light

#ffffffff

OK 搞定, 这样点击的时候就会背景不一样了

android linearlayout背景色,Android LinearLayout 点击背景颜色改变相关推荐

  1. android自定义主题背景颜色,Android 自定义SeekBar 实现分段显示不同背景颜色的示例代码...

    在最近的开发工作中,要实现一个调色板的进度条,SeekBar要分成10段显示不同颜色,功夫不负有心人,终于实现了这个功能,下面分享给大家 示例图: 1.自定义SeekBar import androi ...

  2. html设置表格点击变色,js实现表格变色点击行颜色改变

     forword js实现表格变色点击行颜色改变 table table { border-top:1px   solid   black; border-left:1px   solid   b ...

  3. android linearlayout背景色,Android LinearLayout选择器背景颜色

    小智.. 15 我使用线性布局作为按钮,然而,我没有任何指定为可点击的东西,它似乎工作得很好.我已经为我的标准按钮设置了一个样式,我只是将该样式分配给线性布局,就像我任何其他按钮一样. linearl ...

  4. android通知背景色,android – 更改通知RemoteViews背景颜色

    我在使用Application-Theme更改Background-Color时遇到问题. NotificationCompat.Builder nBuilder = new Notification ...

  5. 关于Android TabHost切换Tab字体的颜色背景颜色改变

    最近在做一个平板电脑点餐的系统,要用到TabHost,不太好写,写好了分享给大家,先上图片,默认效果: 切换后效果 先是layout文件夹中的布局文件,代码如下: <TabHost xmlns: ...

  6. android 4.2修改设置菜单的背景颜色

    设置中的背景主要来主题的设置, 在4.X后, android添加了新的主题: Holo 从Settings/AndroidManifest.xml中找到: Xml代码   <applicatio ...

  7. android tabhost黑色背景,关于Android TabHost切换Tab字体的颜色背景颜色改变

    最近在做一个平板电脑点餐的系统,要用到TabHost,不太好写,写好了分享给大家,先上图片,默认效果: 切换后效果 先是layout文件夹中的布局文件,代码如下: android:id="@ ...

  8. android设置xml为背景颜色,android – 如何通过XML将textview的背景颜色设置为全息绿光?...

    通过Java: TextView test = (TextView) view.findViewById(R.id.textView2); test.setBackgroundResource(con ...

  9. php 验证码的背景色,做验证码时ImageCreatetruecolor背景颜色只显黑色的解决办法

    在学习PHP GD库函数时遇到一问题; 在开启GD库函数后,制作一个小验证码图片! imagecreatetruecolor(int 宽,int 高): 调色, imagecolorallocate( ...

最新文章

  1. 漫画:最长公共子序列
  2. mysql数据库导出后乱码问题_MySQL导入导出数据出现乱码的解决办法
  3. 简述在虚拟机中安装 centos 的过程_从零构建Fabric开发运行环境手册(一):安装OS虚拟机(CentOS)...
  4. linux 全新编译安装,全新linux中通过编译方式安装nginx
  5. newcode Islands 思维
  6. ALM 中查看某个 test 的更改 history 历史
  7. SonarQube 规则的挂起与激活
  8. WP Rocket插件无需授权版本
  9. 腾讯优图提出LCVR-MQVI算法,勇夺NTIRE 2021双赛道冠亚军
  10. 【报告分享】2020年B站UP主价值研究报告.pdf(附下载链接)
  11. 春季:@Component与@Bean
  12. 手机端与pc端页面html5,浅谈pc和移动端的响应式的使用
  13. shell之文本过滤(awk)(转)
  14. APP,webapp 设计相关资料汇集区
  15. 视频编码格式全面解析
  16. 手机端app存取session问题(tp5框架)
  17. Android Fingerprint属性
  18. 网站关键词优化技巧都有哪些?如何进行优化?
  19. 渲染算法学习(七)-- Real-Time Ray Tracing
  20. 什么是5G?它能为我们带来什么样的便利?思维导图《5G时代》给你新认识

热门文章

  1. C# EventHandler
  2. 浅析PCIe MPS对系统性能和稳定性的影响
  3. 计算机术语中分辨率是什么意思,分辨率是什么(什么是像素?分辨率是什么?)...
  4. Java开发面试题含答案(计算机网络、操作系统、Java、Mysql、Redis、Spring)
  5. lolSix周年活动页面
  6. Win API使用记录--RtlCopyMemory与RtlMoveMemory区别
  7. 将springboot单体项目部署到腾讯云服务器上
  8. matlab中find函数
  9. 数码管动态显示Verilog实现(参考小梅哥教程)(视觉暂留)
  10. 疫情病毒全部“抹杀”?