Android基础之在程序代码中引用资源(color&mipmap&string)
来源:互联网 发布:逆战自动开枪脚本源码 编辑:程序博客网 时间:2024/06/05 16:17
1.设置背景图片,图片来源于drawable;
TextView.setBackgroundDrawable(getResources().getDrawable(R.drawable.search));TextView..setBackgroundResource(R.drawable.search);
2.设置背景颜色
TextView.setBackgroundColor(getResources().getColor(R.color.bg_red));TextView..setBackgroundColor(0xFFFF0000);
2.转换字符串为int(颜色);
TextView.deleteFilghtBg.setBackgroundColor(Color.parseColor("#F5F5DC"));
3.使用String资源
this.getResources().getString(R.string.setIP);
0 0
- Android基础之在程序代码中引用资源(color&mipmap&string)
- android在程序代码中使用String资源
- Android资源解析之mipmap
- android在程序代码中使用res目录下的String资源
- android 资源之 color
- android,在java代码中,如何给textview设置不同的颜色,以及引用color中资源设置颜色
- Android Studio引用mipmap中引用.9图片报错
- Android Studio引用mipmap中引用.9图片报错
- Android Studio引用mipmap中引用.9图片报错
- android studio 中mipmap引用.9图片出错
- Error : android studio 中mipmap引用.9图片出错
- 找不到资源“$(string.NoReportSiteProblems)”(在 属性 displayName 中引用)。
- android studio drawable文件下xml 引用 mipmap 资源文件问题
- 关于AndroidStudio中引用MipMap图片资源无法预览的问题研究
- Android中获取res(xml,color)资源
- android ecilpse中使用color资源
- Android布局类型资源(一)---color、string、dimen
- Android studio mipmap图片资源文件夹
- LDA
- jasper报表添加显示字段
- js面向对象编程-高级内容
- Nginx配置---性能篇
- openwrt启动过程中
- Android基础之在程序代码中引用资源(color&mipmap&string)
- Android IPC进程通信——Messager方式
- GhostScript应用一例:使用GhostScript强行修改加密PDF
- laravel-homestead环境搭建
- Javascript模块化编程
- activity 四种启动模式详解
- 系统分析师教材
- 机器学习和计算机视觉相关的数学
- MD5加密