转载请标明出处:

http://blog.csdn.net/lmj623565791/article/details/46405409

本文出自:【张鸿洋的博客】

一、概述

Google I/O 2015 给大家带来了Android Design Support Library。对于希望做md风格的app的来说,简直是天大的喜讯了~大家能够通过Android Design Support Library该文章对其进行了解,也能够直接在github上下载演示样例代码执行学习。为了表达我心中的喜悦,我决定针对该库写一系列的文章来分别介绍新添加的控件。

ok,那么首先介绍的就是NavigationView。

注意下更新下as的SDK,然后在使用的过程中,在build.gradle中加入:

  1. compile 'com.android.support:design:22.2.0'

在md风格的app中,比如例如以下风格的側滑菜单非经常见:

在之前的设计中。你可能须要考虑怎样去布局实现,比如使用ListView;再者还要去设计Item的选中状态之类~~

but,如今。google提供了NavigationView,你只须要写写布局文件。这种效果就ok了,而且兼容到Android 2.1。非常值得去体验一下。

接下来我们来介绍怎样去使用这个NavigationView

二、使用

使用起来very simple ,主要就是写写布局文件~

(一)布局文件

  1. <?xml version="1.0" encoding="utf-8"?
  2. >
  3. <android.support.v4.widget.DrawerLayout
  4. android:id="@+id/id_drawer_layout"
  5. xmlns:android="http://schemas.android.com/apk/res/android"
  6. xmlns:app="http://schemas.android.com/apk/res-auto"
  7. android:layout_width="match_parent"
  8. android:layout_height="match_parent"
  9. android:fitsSystemWindows="true"
  10. >
  11. <RelativeLayout
  12. android:layout_width="match_parent"
  13. android:layout_height="match_parent">
  14. <android.support.v7.widget.Toolbar
  15. android:id="@+id/id_toolbar"
  16. android:layout_width="match_parent"
  17. android:layout_height="?
  18. attr/actionBarSize"
  19. android:background="?attr/colorPrimary"
  20. app:layout_scrollFlags="scroll|enterAlways"
  21. app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
  22. <TextView
  23. android:id="@+id/id_tv_content"
  24. android:layout_width="wrap_content"
  25. android:layout_height="wrap_content"
  26. android:layout_centerInParent="true"
  27. android:text="HelloWorld"
  28. android:textSize="30sp"/>
  29. </RelativeLayout>
  30. <android.support.design.widget.NavigationView
  31. android:id="@+id/id_nv_menu"
  32. android:layout_width="match_parent"
  33. android:layout_height="match_parent"
  34. android:layout_gravity="left"
  35. android:fitsSystemWindows="true"
  36. app:headerLayout="@layout/header_just_username"
  37. app:menu="@menu/menu_drawer"
  38. />
  39. </android.support.v4.widget.DrawerLayout>

能够看到我们的最外层是DrawerLayout。里面一个content。一个作为drawer。我们的drawer为NavigationView

注意这个view的两个属性app:headerLayout="@layout/header_just_username"app:menu="@menu/menu_drawer",分别代表drawer布局中的header和menuitem区域。当然你能够依据自己的情况使用。

接下来看看header的布局文件和menu配置文件:


  1. <?xml version="1.0" encoding="utf-8"?>
  2. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:layout_width="match_parent"
  4. android:layout_height="192dp"
  5. android:background="?attr/colorPrimaryDark"
  6. android:orientation="vertical"
  7. android:padding="16dp"
  8. android:theme="@style/ThemeOverlay.AppCompat.Dark">
  9. <TextView
  10. android:id="@+id/id_link"
  11. android:layout_width="wrap_content"
  12. android:layout_height="wrap_content"
  13. android:layout_alignParentBottom="true"
  14. android:layout_marginBottom="16dp"
  15. android:text="http://blog.csdn.net/lmj623565791"/>
  16. <TextView
  17. android:id="@+id/id_username"
  18. android:layout_width="wrap_content"
  19. android:layout_height="wrap_content"
  20. android:layout_above="@id/id_link"
  21. android:text="Zhang Hongyang"/>
  22. <ImageView
  23. android:layout_width="72dp"
  24. android:layout_height="72dp"
  25. android:layout_above="@id/id_username"
  26. android:layout_marginBottom="16dp"
  27. android:src="@mipmap/icon"/>
  28. </RelativeLayout>
  1. <?
  2. xml version="1.0" encoding="utf-8"?>
  3. <menu xmlns:android="http://schemas.android.com/apk/res/android">
  4. <group android:checkableBehavior="single">
  5. <item
  6. android:id="@+id/nav_home"
  7. android:icon="@drawable/ic_dashboard"
  8. android:title="Home"/>
  9. <item
  10. android:id="@+id/nav_messages"
  11. android:icon="@drawable/ic_event"
  12. android:title="Messages"/>
  13. <item
  14. android:id="@+id/nav_friends"
  15. android:icon="@drawable/ic_headset"
  16. android:title="Friends"/>
  17. <item
  18. android:id="@+id/nav_discussion"
  19. android:icon="@drawable/ic_forum"
  20. android:title="Discussion"/>
  21. </group>
  22. <item android:title="Sub items">
  23. <menu>
  24. <item
  25. android:icon="@drawable/ic_dashboard"
  26. android:title="Sub item 1"/>
  27. <item
  28. android:icon="@drawable/ic_forum"
  29. android:title="Sub item 2"/>
  30. </menu>
  31. </item>
  32. </menu>

别放错目录哈~

布局文件写完了,基本就好了,是不是非常爽~看似复杂的效果,写写布局文件就ok。

ps:默认的颜色非常多是从当前的主题中提取的。比方icon的stateColor,当然你也能够通过以下属性改动部分样式:

  1. app:itemIconTint=""
  2. app:itemBackground=""
  3. app:itemTextColor=""

(二)Activity

最后是Activity:

  1. package com.imooc.testandroid;
  2. import android.os.Bundle;
  3. import android.support.design.widget.NavigationView;
  4. import android.support.v4.widget.DrawerLayout;
  5. import android.support.v7.app.ActionBar;
  6. import android.support.v7.app.ActionBarActivity;
  7. import android.support.v7.widget.Toolbar;
  8. import android.view.MenuItem;
  9. public class NavigationViewActivity extends ActionBarActivity
  10. {
  11. private DrawerLayout mDrawerLayout;
  12. private NavigationView mNavigationView;
  13. @Override
  14. protected void onCreate(Bundle savedInstanceState)
  15. {
  16. super.onCreate(savedInstanceState);
  17. setContentView(R.layout.activity_navigation_view);
  18. mDrawerLayout = (DrawerLayout) findViewById(R.id.id_drawer_layout);
  19. mNavigationView = (NavigationView) findViewById(R.id.id_nv_menu);
  20. Toolbar toolbar = (Toolbar) findViewById(R.id.id_toolbar);
  21. setSupportActionBar(toolbar);
  22. final ActionBar ab = getSupportActionBar();
  23. ab.setHomeAsUpIndicator(R.drawable.ic_menu);
  24. ab.setDisplayHomeAsUpEnabled(true);
  25. setupDrawerContent(mNavigationView);
  26. }
  27. private void setupDrawerContent(NavigationView navigationView)
  28. {
  29. navigationView.setNavigationItemSelectedListener(
  30. new NavigationView.OnNavigationItemSelectedListener()
  31. {
  32. @Override
  33. public boolean onNavigationItemSelected(MenuItem menuItem)
  34. {
  35. menuItem.setChecked(true);
  36. mDrawerLayout.closeDrawers();
  37. return true;
  38. }
  39. });
  40. }
  41. @Override
  42. public boolean onCreateOptionsMenu(Menu menu)
  43. {
  44. // Inflate the menu; this adds items to the action bar if it is present.
  45. getMenuInflater().inflate(R.menu.menu_navigation_view, menu);
  46. return true;
  47. }
  48. @Override
  49. public boolean onOptionsItemSelected(MenuItem item)
  50. {
  51. if(item.getItemId() == android.R.id.home)
  52. {
  53. mDrawerLayout.openDrawer(GravityCompat.START);
  54. return true ;
  55. }
  56. return super.onOptionsItemSelected(item);
  57. }
  58. }

我们在Activity里面能够通过navigationView去navigationView.setNavigationItemSelectedListener,当selected的时候。menuItem去setChecked(true)。

别忘了设置theme~

  1. <resources>
  2. <!-- Base application theme. -->
  3. <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
  4. <!-- Customize your theme here. -->
  5. </style>
  6. <style name="Theme.DesignDemo" parent="Base.Theme.DesignDemo">
  7. </style>
  8. <style name="Base.Theme.DesignDemo" parent="Theme.AppCompat.Light.NoActionBar">
  9. <item name="colorPrimary">#673AB7</item>
  10. <item name="colorPrimaryDark">#512DA8</item>
  11. <item name="colorAccent">#FF4081</item>
  12. <item name="android:windowBackground">@color/window_background</item>
  13. </style>
  14. </resources>
  15. <color name="window_background">#FFF5F5F5</color>
  16. <activity
  17. android:name=".NavigationViewActivity"
  18. android:label="@string/title_activity_navigation_view"
  19. android:theme="@style/Theme.DesignDemo">
  20. </activity>

ok。到此就搞定了~~

不过存在一个问题,此时你假设点击Sub items里面的Sub item,假设你期望当前选中应该是Sub item。你会发现不起作用。那怎么办呢?

(三)Sub Item支持Cheable

这里能够改动menu的配置文件:

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <menu xmlns:android="http://schemas.android.com/apk/res/android">
  3. <group>
  4. <item
  5. android:id="@+id/nav_home"
  6. android:checkable="true"
  7. android:icon="@drawable/ic_dashboard"
  8. android:title="Home"/>
  9. <item
  10. android:id="@+id/nav_messages"
  11. android:checkable="true"
  12. android:icon="@drawable/ic_event"
  13. android:title="Messages"/>
  14. <item
  15. android:id="@+id/nav_friends"
  16. android:checkable="true"
  17. android:icon="@drawable/ic_headset"
  18. android:title="Friends"/>
  19. <item
  20. android:id="@+id/nav_discussion"
  21. android:checkable="true"
  22. android:icon="@drawable/ic_forum"
  23. android:title="Discussion"/>
  24. </group>
  25. <item android:title="Sub items">
  26. <menu>
  27. <item
  28. android:checkable="true"
  29. android:icon="@drawable/ic_dashboard"
  30. android:title="Sub item 1"/>
  31. <item
  32. android:checkable="true"
  33. android:icon="@drawable/ic_forum"
  34. android:title="Sub item 2"/>
  35. </menu>
  36. </item>
  37. </menu>

android:checkableBehavior="single"去掉,然后给每一个item项加入android:checkable="true"

然后在代码中:

  1. navigationView.setNavigationItemSelectedListener(
  2. new NavigationView.OnNavigationItemSelectedListener()
  3. {
  4. private MenuItem mPreMenuItem;
  5. @Override
  6. public boolean onNavigationItemSelected(MenuItem menuItem)
  7. {
  8. if (mPreMenuItem != null) mPreMenuItem.setChecked(false);
  9. menuItem.setChecked(true);
  10. mDrawerLayout.closeDrawers();
  11. mPreMenuItem = menuItem;
  12. return true;
  13. }
  14. });

存一下preMenuItem。手动切换。

效果:

ok,哈~事实上这个还是參考链接2里面的一个评论说的~~

到此使用方法就介绍完了有木有一点小激动~ 可是还有个问题。对于app,就像ActionBar最初的出现,一開始大家都欢欣鼓励,后来发现app中多数情况下须要去定制,尼玛。是不是忽然认为ActionBar太死板了,恶心死了(当然了如今有了ToolBar灵活度上好多了)对于上述NavigationView可能也会存在定制上的问题。比方我希望选中的Item左边有个高亮的竖线之类的效果。

那么,针对于各种需求,想要能解决各种问题,最好的方式就是说对于NavigationView的效果自己能够实现。

最好,我们就来看看NavigationView自己实现有多难?

三、自己实现NavigationView效果

事实上NavigationView的实现非常easy,一个ListView就能够了。甚至都不须要去自己定义,简单写一个Adapter即可了~~

首先观察该图,有没有发现奇妙之处。恩,你肯定发现不了,由于我们做的太像了。

事实上这个图就是我通过ListView写的一个~是不是和原版非常像(~哈~參考了源代码的实现,当然像。)

接下来分析。假设说是ListView,那么Item的type肯定不止一种,那我们数一数种类:

  • 带图标和文本的
  • 不过文本的 Sub Items
  • 切割线

你会说还有顶部那个。顶部是headview呀~~

这么分析完毕,是不是瞬间认为没有难度了~

(一)首先布局文件

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <android.support.v4.widget.DrawerLayout
  3. android:id="@+id/id_drawer_layout"
  4. xmlns:android="http://schemas.android.com/apk/res/android"
  5. xmlns:app="http://schemas.android.com/apk/res-auto"
  6. android:layout_width="match_parent"
  7. android:layout_height="match_parent"
  8. android:fitsSystemWindows="true"
  9. >
  10. <RelativeLayout
  11. android:layout_width="match_parent"
  12. android:layout_height="match_parent">
  13. <android.support.v7.widget.Toolbar
  14. android:id="@+id/id_toolbar"
  15. android:layout_width="match_parent"
  16. android:layout_height="?
  17. attr/actionBarSize"
  18. android:background="?
  19. attr/colorPrimary"
  20. app:layout_scrollFlags="scroll|enterAlways"
  21. app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
  22. <TextView
  23. android:id="@+id/id_tv_content"
  24. android:layout_width="wrap_content"
  25. android:layout_height="wrap_content"
  26. android:layout_centerInParent="true"
  27. android:text="HelloWorld"
  28. android:textSize="30sp"/>
  29. </RelativeLayout>
  30. <ListView
  31. android:id="@+id/id_lv_left_menu"
  32. android:layout_width="match_parent"
  33. android:layout_height="match_parent"
  34. android:layout_gravity="start"
  35. android:paddingTop="0dp"
  36. android:background="#ffffffff"
  37. android:clipToPadding="false"
  38. android:divider="@null"
  39. android:listSelector="?attr/selectableItemBackground"
  40. />
  41. </android.support.v4.widget.DrawerLayout>

布局文件上:和上文对照,我们只把NavigationView换成了ListView.

以下注意了,一大波代码来袭.

(二) Activity

  1. package com.imooc.testandroid;
  2. public class NavListViewActivity extends ActionBarActivity
  3. {
  4. private ListView mLvLeftMenu;
  5. private DrawerLayout mDrawerLayout;
  6. @Override
  7. protected void onCreate(Bundle savedInstanceState)
  8. {
  9. super.onCreate(savedInstanceState);
  10. setContentView(R.layout.activity_nav_list_view);
  11. mDrawerLayout = (DrawerLayout) findViewById(R.id.id_drawer_layout);
  12. mLvLeftMenu = (ListView) findViewById(R.id.id_lv_left_menu);
  13. Toolbar toolbar = (Toolbar) findViewById(R.id.id_toolbar);
  14. setSupportActionBar(toolbar);
  15. final ActionBar ab = getSupportActionBar();
  16. ab.setHomeAsUpIndicator(R.drawable.ic_menu);
  17. ab.setDisplayHomeAsUpEnabled(true);
  18. setUpDrawer();
  19. }
  20. private void setUpDrawer()
  21. {
  22. LayoutInflater inflater = LayoutInflater.from(this);
  23. mLvLeftMenu.addHeaderView(inflater.inflate(R.layout.header_just_username, mLvLeftMenu, false));
  24. mLvLeftMenu.setAdapter(new MenuItemAdapter(this));
  25. }
  26. @Override
  27. public boolean onCreateOptionsMenu(Menu menu)
  28. {
  29. // Inflate the menu; this adds items to the action bar if it is present.
  30. getMenuInflater().inflate(R.menu.menu_nav_list_view, menu);
  31. return true;
  32. }
  33. @Override
  34. public boolean onOptionsItemSelected(MenuItem item)
  35. {
  36. // Handle action bar item clicks here. The action bar will
  37. // automatically handle clicks on the Home/Up button, so long
  38. // as you specify a parent activity in AndroidManifest.xml.
  39. int id = item.getItemId();
  40. //noinspection SimplifiableIfStatement
  41. if (id == android.R.id.home)
  42. {
  43. mDrawerLayout.openDrawer(GravityCompat.START);
  44. return true;
  45. }
  46. return super.onOptionsItemSelected(item);
  47. }
  48. }

直接看onCreate中的setUpDrawer(),能够看到我们首先去addHeadView。然后去setAdapter。

那么核心代码就是我们的Adapter了~~

(三)MenuItemAdapter

  1. public class LvMenuItem
  2. {
  3. public LvMenuItem(int icon, String name)
  4. {
  5. this.icon = icon;
  6. this.name = name;
  7. if (icon == NO_ICON && TextUtils.isEmpty(name))
  8. {
  9. type = TYPE_SEPARATOR;
  10. } else if (icon == NO_ICON)
  11. {
  12. type = TYPE_NO_ICON;
  13. } else
  14. {
  15. type = TYPE_NORMAL;
  16. }
  17. if (type != TYPE_SEPARATOR && TextUtils.isEmpty(name))
  18. {
  19. throw new IllegalArgumentException("you need set a name for a non-SEPARATOR item");
  20. }
  21. L.e(type + "");
  22. }
  23. public LvMenuItem(String name)
  24. {
  25. this(NO_ICON, name);
  26. }
  27. public LvMenuItem()
  28. {
  29. this(null);
  30. }
  31. private static final int NO_ICON = 0;
  32. public static final int TYPE_NORMAL = 0;
  33. public static final int TYPE_NO_ICON = 1;
  34. public static final int TYPE_SEPARATOR = 2;
  35. int type;
  36. String name;
  37. int icon;
  38. }
  39. public class MenuItemAdapter extends BaseAdapter
  40. {
  41. private final int mIconSize;
  42. private LayoutInflater mInflater;
  43. private Context mContext;
  44. public MenuItemAdapter(Context context)
  45. {
  46. mInflater = LayoutInflater.from(context);
  47. mContext = context;
  48. mIconSize = context.getResources().getDimensionPixelSize(R.dimen.drawer_icon_size);//24dp
  49. }
  50. private List<LvMenuItem> mItems = new ArrayList<LvMenuItem>(
  51. Arrays.asList(
  52. new LvMenuItem(R.drawable.ic_dashboard, "Home"),
  53. new LvMenuItem(R.drawable.ic_event, "Messages"),
  54. new LvMenuItem(R.drawable.ic_headset, "Friends"),
  55. new LvMenuItem(R.drawable.ic_forum, "Discussion"),
  56. new LvMenuItem(),
  57. new LvMenuItem("Sub Items"),
  58. new LvMenuItem(R.drawable.ic_dashboard, "Sub Item 1"),
  59. new LvMenuItem(R.drawable.ic_forum, "Sub Item 2")
  60. ));
  61. @Override
  62. public int getCount()
  63. {
  64. return mItems.size();
  65. }
  66. @Override
  67. public Object getItem(int position)
  68. {
  69. return mItems.get(position);
  70. }
  71. @Override
  72. public long getItemId(int position)
  73. {
  74. return position;
  75. }
  76. @Override
  77. public int getViewTypeCount()
  78. {
  79. return 3;
  80. }
  81. @Override
  82. public int getItemViewType(int position)
  83. {
  84. return mItems.get(position).type;
  85. }
  86. @Override
  87. public View getView(int position, View convertView, ViewGroup parent)
  88. {
  89. LvMenuItem item = mItems.get(position);
  90. switch (item.type)
  91. {
  92. case LvMenuItem.TYPE_NORMAL:
  93. if (convertView == null)
  94. {
  95. convertView = mInflater.inflate(R.layout.design_drawer_item, parent,
  96. false);
  97. }
  98. TextView itemView = (TextView) convertView;
  99. itemView.setText(item.name);
  100. Drawable icon = mContext.getResources().getDrawable(item.icon);
  101. setIconColor(icon);
  102. if (icon != null)
  103. {
  104. icon.setBounds(0, 0, mIconSize, mIconSize);
  105. TextViewCompat.setCompoundDrawablesRelative(itemView, icon, null, null, null);
  106. }
  107. break;
  108. case LvMenuItem.TYPE_NO_ICON:
  109. if (convertView == null)
  110. {
  111. convertView = mInflater.inflate(R.layout.design_drawer_item_subheader,
  112. parent, false);
  113. }
  114. TextView subHeader = (TextView) convertView;
  115. subHeader.setText(item.name);
  116. break;
  117. case LvMenuItem.TYPE_SEPARATOR:
  118. if (convertView == null)
  119. {
  120. convertView = mInflater.inflate(R.layout.design_drawer_item_separator,
  121. parent, false);
  122. }
  123. break;
  124. }
  125. return convertView;
  126. }
  127. public void setIconColor(Drawable icon)
  128. {
  129. int textColorSecondary = android.R.attr.textColorSecondary;
  130. TypedValue value = new TypedValue();
  131. if (!mContext.getTheme().resolveAttribute(textColorSecondary, value, true))
  132. {
  133. return;
  134. }
  135. int baseColor = mContext.getResources().getColor(value.resourceId);
  136. icon.setColorFilter(baseColor, PorterDuff.Mode.MULTIPLY);
  137. }
  138. }

首先我们的每一个Item相应于一个LvMenuItem。包括icon、name、type。能够看到我们的type分为3类。

那么adapter中代码就非常easy了,多Item布局的写法。

这样就完毕了,我们自己去书写NavigationView,是不是非常easy~~假设你的app须要相似效果,可是又与NavigationView的效果并不是一模一样。能够考虑依照上面的思路自己写一个。

最后贴一下用到的Item的布局文件:

  • design_drawer_item_subheader.xml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <TextView xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:layout_width="match_parent"
  4. android:layout_height="?
  5. attr/listPreferredItemHeightSmall"
  6. android:gravity="center_vertical|start"
  7. android:maxLines="1"
  8. android:paddingLeft="?attr/listPreferredItemPaddingLeft"
  9. android:paddingRight="?
  10. attr/listPreferredItemPaddingRight"
  11. android:textAppearance="?
  12. attr/textAppearanceListItem"
  13. android:textColor="?android:textColorSecondary"/>
  • design_drawer_item_separator.xml

  1. <?
  2. xml version="1.0" encoding="utf-8"?
  3. >
  4. <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  5. android:layout_width="match_parent"
  6. android:layout_height="wrap_content">
  7. <View android:layout_width="match_parent"
  8. android:layout_height="1dp"
  9. android:background="?android:attr/listDivider"/>
  10. </FrameLayout>
  • design_drawer_item,xml:
  1. <?
  2. xml version="1.0" encoding="utf-8"?
  3. >
  4. <TextView
  5. xmlns:android="http://schemas.android.com/apk/res/android"
  6. android:layout_width="match_parent"
  7. android:layout_height="?attr/listPreferredItemHeightSmall"
  8. android:paddingLeft="?attr/listPreferredItemPaddingLeft"
  9. android:paddingRight="?attr/listPreferredItemPaddingRight"
  10. android:drawablePadding="32dp"
  11. android:gravity="center_vertical|start"
  12. android:maxLines="1"
  13. android:textAppearance="?attr/textAppearanceListItem"
  14. android:textColor="?
  15. android:attr/textColorPrimary"/>

ok。事实上上述ListView的写法也正是NavigationView的源代码实现~~item的布局文件直接从源代码中拖出来的,还是爽爽哒~

源代码点击下载

~~hava a nice day ~~

新浪微博

微信公众号:hongyangAndroid

(欢迎关注,第一时间推送博文信息)

參考链接

Android 自己实现 NavigationView [Design Support Library(1)]的更多相关文章

  1. Android Design Support Library(二)用NavigationView实现抽屉菜单界面

    NavigationView在MD设计中非常重要,之前Google也提出了使用DrawerLayout来实现导航抽屉.这次,在Android Design Support Library中,Googl ...

  2. Android Design Support Library初探,NavigationView实践

    前言 在前几天的IO大会上,Google带来了Android M,同时还有Android支持库的新一轮更新,其中更是增加一个全新的支持库Android Design Support Library,包 ...

  3. Android Design Support Library使用详解

    Android Design Support Library使用详解 Google在2015的IO大会上,给我们带来了更加详细的Material Design设计规范,同时,也给我们带来了全新的And ...

  4. 【转】【翻】Android Design Support Library 的 代码实验——几行代码,让你的 APP 变得花俏

    转自:http://mrfufufu.github.io/android/2015/07/01/Codelab_Android_Design_Support_Library.html [翻]Andro ...

  5. 【转】Android的材料设计兼容库(Design Support Library)

    转自:http://www.jcodecraeer.com/a/anzhuokaifa/developer/2015/0531/2958.html?mType=Group Android的材料设计兼容 ...

  6. Android应用Design Support Library完全使用实例

    阅读目录 2-1 综述 2-2 TextInputLayout控件 2-3 FloatingActionButton控件 2-4 Snackbar控件 2-5 TabLayout控件 2-6 Navi ...

  7. Android Design Support Library 的 代码实验——几行代码,让你的 APP 变得花俏

    原文:Codelab for Android Design Support Library used in I/O Rewind Bangkok session--Make your app fanc ...

  8. Codelab for Android Design Support Library used in I/O Rewind Bangkok session

    At the moment I believe that there is no any Android Developer who doesn't know about Material Desig ...

  9. Material Design 开发利器:Android Design Support Library 介绍

    转自:https://blog.leancloud.cn/3306/ Android 5.0 Lollipop 是迄今为止最重大的一次发布,很大程度上是因为 material design —— 这是 ...

随机推荐

  1. NX-bridge,可以实现无线XBee控制的Arduino板

    ”今天Elecfreaks Studio给你介绍一个新的.很实用的朋友:带有一些奇幻色彩的神秘设备.它是什么呢?它可以完成什么功能呢?它对我们的生活有哪些促进呢?非常感兴趣吧?别着急,我们这就给您详细 ...

  2. LEAVE LIST-PROCESSING和LEAVE TO LIST-PROCESSING事件的作用

    START-OF-SELECTION. MESSAGE '屏幕报错' TYPE 'S' DISPLAY LIKE 'E'. LEAVE LIST-PROCESSING. 这样子的话 报错会返回包选择屏 ...

  3. DRP分销系统总结

    上个月看完的分销系统的视频,用了漫长的时间看这个项目视频,能安慰自己的是不光是看视频了,还做了很多自己想做的事情,比如驾照拿下来了,比如参加了一些考试,比如讲了一些课程等等.把这个系统的总结总算是补上 ...

  4. 算法设计与分析——多边形游戏(DP)

    1.问题描述:   给定N个顶点的多边形,每个顶点标有一个整数,每条边上标有+(加)或是×(乘)号,并且N条边按照顺时针依次编号为1~N.下图给出了一个N=4个顶点的多边形. 游戏规则 :(1) 首先 ...

  5. ASIO攻破!!!----转

    from:http://www.cppblog.com/shanoa/archive/2009/06/26/88606.aspx 花了足足3天时间,外加1天心情休整,终于在第5天编写出了一个能运行的基 ...

  6. hdu4847 Wow! Such Doge!(简单题+坑爹的输入)

    转载请注明出处:http://blog.csdn.net/u012860063?viewmode=contents 题目链接:http://acm.hdu.edu.cn/showproblem.php ...

  7. UML基本架构建模--类概述

     Classes 类 Classes are the most important building block of any object-oriented system. A class is ...

  8. MFC 用gdi绘制填充多边形区域

    MFC 用gdi绘制填充多边形区域 这里的代码是实现一个三角形的绘制,并用刷子填充颜色 在OnPaint()函数里面 运用的是给定的三角形的三个点,很多个点可以绘制多边形 CBrush br(RGB( ...

  9. Lucene.Net 2.3.1开发介绍 —— 三、索引(五)

    原文:Lucene.Net 2.3.1开发介绍 -- 三.索引(五) 话接上篇,继续来说权重对排序的影响.从上面的4个测试,只能说是有个直观的理解了.“哦,是!调整权重是能影响排序了,但是好像没办法来 ...

  10. Nginx和Tomcat负载均衡实现session共享(转)

    以前的项目使用Nginx作为反向代理实现了多个Tomcat的负载均衡,为了实现多个Tomcat之间的session共享,使用了开源的Memcached-Session-Manager框架. 此框架的优 ...