android nagative drawer图标跟标题适配
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">xxx</string>
<string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string>
<string name="action_example">Example action</string>
<string name="action_settings">Settings</string>
赵存档 QQ463431476
<string-array name="sections">
<item>xxx</item>
</string-array>
<string-array name="section_titles">
<item>xxx</item>
</string-array>
<string-array name="sections_icons">
<item>@drawable/see</item>
<item>@drawable/settings</item>
<item>@drawable/figure</item>
<item>@drawable/wifi</item>
<item>@drawable/mic</item>
<item>@drawable/voice</item>
</string-array>
http://www.cnblogs.com/xiaobo-Linux/ QQ463431476
http://www.cnblogs.com/xiaobo-Linux/
public void onSectionAttached(int number) {
//标题
String[] stringArray = getResources().getStringArray(R.array.section_titles);
mTitle = stringArray[number-1];
switch (number) {
case 1:
getSupportFragmentManager().beginTransaction()
.replace(R.id.container, new Robot()).commit();
break;
}
}
//数据适配器
final TypedArray typedArray = getResources().obtainTypedArray(R.array.sections_icons);
mDrawerListView.setAdapter(new ArrayAdapter<String>(
getActionBar().getThemedContext(),
android.R.layout.simple_list_item_activated_1,
android.R.id.text1,
getResources().getStringArray(R.array.sections)
) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = super.getView(position, convertView, parent);
int resourceId = typedArray.getResourceId(position, 0);
Drawable drawable = getResources().getDrawable(resourceId);
((TextView) v).setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
return v;
}
});
@android:drawable/xxx 是调用sdk安卓系统自带的图片
C:\Program Files (x86)\Android\sdk\platforms\android-15\data\res\drawable-xhdpi
android nagative drawer图标跟标题适配的更多相关文章
- Android Navigation Drawer,自定义ActionBar(标题居中)
整个示例都是改造自 Google Android Training 中的 NavigationDrawer 示例(http://developer.android.com/training/imple ...
- Android Navigation Drawer(导航抽屉)
Google I/O 2013 Android 更新了Support库,新版本的Support库中新加入了几个比较重要的功能. 添加 DrawerLayout 控件,支持创建 Navigation ...
- 浅谈Android系统的图标设计规范
http://homepage.yesky.com/89/11620089.shtml 目前移动平台的竞争日益激烈,友好的用户界面可以帮助提高用户体验满意度,图标Icon是用户界面中一个重要的组成部分 ...
- Android 尺寸单位转换和屏幕适配相关
Android 尺寸单位转换和屏幕适配相关 各种尺寸单位的意义 dp: Density-independent Pixels 一个抽象的单元,基于屏幕的物理密度. (dp和dip的意义相同,所以不用区 ...
- Android 自带图标库 android.R.drawable
在xml文件中调用. android:title="@string/secure_connect"android:orderInCategory="100"an ...
- android 开发对gif解码(适配android 4.2、4.3、4.4版本)
android 开发对gif解码(适配android 4.2.4.3.4.4版本) 使用方法: public class ImageInputActivity extends Activity imp ...
- 去掉Android新建项目的顶部标题
[ 去掉Android新建项目的顶部标题] 使用NoActionBar的Theme即可. 参考:http://blog.csdn.net/u012246458/article/details/5299 ...
- Android中为图标加上数字
Android中为图标加上数字--用于未读短信数提醒,待更新应用数提醒等 http://flysnow.iteye.com/blog/906770
- 解决Eclipse中Android SDK Manager图标不见了的问题
在Eclipse中安装完ADT后,发现 Android SDK Manager图标不见了,Android Virtual Device Manager图标也不见了. 解决这个问题,可用如下方法: 打开 ...
随机推荐
- 数据结构(c语言第2版)-----了解链表,栈,队列,串
关于链表我觉得这都是最基本的东西,但是不常见,在实际的应用中很少的使用,了解它会用就OK,不需要研究的那么深,除非做那种内存压缩,存储方面工作. C语言中动态申请空间 malloc() q=(dlin ...
- 【linux草鞋应用编程系列】_6_ 重定向和VT100编程
一.文件重定向 我们知道在linux shell 编程的时候,可以使用文件重定向功能,如下所示: [root@localhost pipe]# echo "hello world&q ...
- 谁在关心toString的性能?
谁在关心toString的性能?没有人!除非当你有大量的数据在批量处理,使用toString产生了许多日志.然后,你去调查为何如此之慢,才意识到大部分的toString方法使用的是introspect ...
- Linux下查看版本号,查看存在的普通用户
1. 查看版本号 uname -a ## 查看所有信息 uname --help ## 查看关于uname命令的帮助 2. 查看存在的普通用户 vim /etc/passwd ## 查看passwd文 ...
- 转载:《TypeScript 中文入门教程》 11、声明合并
版权 文章转载自:https://github.com/zhongsp 建议您直接跳转到上面的网址查看最新版本. 介绍 TypeScript有一些独特的概念,有的是因为我们需要描述JavaScript ...
- Linux-安装Oracle(CentOS-Oracle 12c)
第一步:网络连接,在我的上一篇博客中有介绍,不再多说. 网络连接的目的:为了能使用yum命令,在网上直接下载文件. 第二步:前往oracle官网下载12c database服务器端的两个文件:(安装在 ...
- Java--JDK动态代理核心源码解析
1.首先我们了解一下JDK动态代理的使用方法: public static void main(String[] args) { /** * 创建一个Bean对象,该对象实现BeanInterFace ...
- Lind.DDD.Repositories.Redis层介绍
回到目录 之前已经发生了 大叔之前介绍过关于redis的文章,有缓存,队列,分布式pub/sub,数据集缓存以及仓储redis的实现等等,而今天在Lind.DDD的持久化组件里,redis当然也有一席 ...
- karma的基础应用之与fis结合
一.介绍 1. karma是单元测试运行框架,可以集成jasmine断言库,也支持babel. 2.fis是百度前端团队开源推出的前端工程化管理工具. 二.karma的基础应用 1.karma的基础a ...
- Google LOGO现代舞舞蹈动画
效果预览:http://hovertree.com/texiao/js/5.htm 截图: HTML文件代码: <!DOCTYPE html> <html xmlns="h ...