## 本節(jié)引言:
> 本節(jié)給大家?guī)?lái)基礎(chǔ)UI控件部分的最后一個(gè)控件:**DrawerLayout**,官方給我們提供的一個(gè)側(cè)滑菜單 控件,和上一節(jié)的ViewPager一樣,3.0以后引入,低版本使用它,需要v4兼容包,說(shuō)到側(cè)滑,相信 很多人都用過(guò)github上的SlidingMenu,不過(guò)好像有兩個(gè)版本,一個(gè)是單獨(dú)的,另一個(gè)需要依賴另一 個(gè)開源項(xiàng)目:ActionBarSherlock;既然Google為我們提供了這個(gè)控件,為何不用咧,而且在 Material Design設(shè)計(jì)規(guī)范中,隨處可見(jiàn)的很多側(cè)滑菜單的動(dòng)畫效果,大都可以通過(guò)Toolbar + DrawerLayout來(lái)實(shí)現(xiàn)~,本節(jié)我們就來(lái)探究下這個(gè)DrawerLayout的一個(gè)基本用法~還有人喜歡把他 稱為抽屜控件~官方文檔:[DrawerLayout](http://androiddoc.qiniudn.com/reference/android/support/v4/widget/DrawerLayout.html)
* * *
## 1.使用的注意事項(xiàng)
> * **1**.主內(nèi)容視圖一定要是DrawerLayout的第一個(gè)子視圖
> * **2**.主內(nèi)容視圖寬度和高度需要match_parent
> * **3**.必須顯示指定側(cè)滑視圖的android:**layout_gravity屬性**?android:layout_gravity = "start"時(shí),從左向右滑出菜單 android:layout_gravity = "end"時(shí),從右向左滑出菜單 不推薦使用left和right!!!
> * 側(cè)滑視圖的寬度以dp為單位,不建議超過(guò)**320dp**(為了總能看到一些主內(nèi)容視圖)
> * 設(shè)置側(cè)滑事件:mDrawerLayout.setDrawerListener(DrawerLayout.DrawerListener);
> * 要說(shuō)一點(diǎn):可以結(jié)合Actionbar使用當(dāng)用戶點(diǎn)擊Actionbar上的應(yīng)用圖標(biāo),彈出側(cè)滑菜單! 這里就要通過(guò)**ActionBarDrawerToggle**,它是DrawerLayout.DrawerListener的具體實(shí)現(xiàn)類, 我們可以重寫ActionBarDrawerToggle的onDrawerOpened()和onDrawerClosed()以監(jiān)聽抽屜拉出 或隱藏事件!但是這里我們不講,因?yàn)?.0后我們使用的是Toolbar!有興趣的可以自行查閱相關(guān) 文檔!
* * *
## 2.使用代碼示例
* * *
### 示例1:?jiǎn)蝹€(gè)側(cè)滑菜單的實(shí)現(xiàn)
**運(yùn)行效果圖**:

**實(shí)現(xiàn)關(guān)鍵代碼**:
首先是我們的主布局,注意:最外層要是DrawerLayout哦?。。?!
**activity_main.xml**:
~~~
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/ly_content"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ListView
android:id="@+id/list_left_drawer"
android:layout_width="180dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#080808"
android:choiceMode="singleChoice"
android:divider="#FFFFFF"
android:dividerHeight="1dp" />
</android.support.v4.widget.DrawerLayout>
~~~
接著ListView的布局代碼和domain類:Item比較簡(jiǎn)單,就不給出了,直接上中間Fragment的 布局以及代碼吧!另外Adapter直接復(fù)用我們之前寫的那個(gè)可復(fù)用的MyAdapter!
**fg_content.xml**:
~~~
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/tv_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:textSize="25sp" />
</RelativeLayout>
~~~
**ContentFragment.java**:
~~~
/**
* Created by Jay on 2015/10/8 0008.
*/
public class ContentFragment extends Fragment {
private TextView tv_content;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fg_content, container, false);
tv_content = (TextView) view.findViewById(R.id.tv_content);
String text = getArguments().getString("text");
tv_content.setText(text);
return view;
}
}
~~~
最后是我們的Activity類
**MainActivity.java**:
~~~
public class MainActivity extends AppCompatActivity implements AdapterView.OnItemClickListener{
private DrawerLayout drawer_layout;
private ListView list_left_drawer;
private ArrayList<Item> menuLists;
private MyAdapter<Item> myAdapter = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
drawer_layout = (DrawerLayout) findViewById(R.id.drawer_layout);
list_left_drawer = (ListView) findViewById(R.id.list_left_drawer);
menuLists = new ArrayList<Item>();
menuLists.add(new Item(R.mipmap.iv_menu_realtime,"實(shí)時(shí)信息"));
menuLists.add(new Item(R.mipmap.iv_menu_alert,"提醒通知"));
menuLists.add(new Item(R.mipmap.iv_menu_trace,"活動(dòng)路線"));
menuLists.add(new Item(R.mipmap.iv_menu_settings,"相關(guān)設(shè)置"));
myAdapter = new MyAdapter<Item>(menuLists,R.layout.item_list) {
@Override
public void bindView(ViewHolder holder, Item obj) {
holder.setImageResource(R.id.img_icon,obj.getIconId());
holder.setText(R.id.txt_content, obj.getIconName());
}
};
list_left_drawer.setAdapter(myAdapter);
list_left_drawer.setOnItemClickListener(this);
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
ContentFragment contentFragment = new ContentFragment();
Bundle args = new Bundle();
args.putString("text", menuLists.get(position).getIconName());
contentFragment.setArguments(args);
FragmentManager fm = getSupportFragmentManager();
fm.beginTransaction().replace(R.id.ly_content,contentFragment).commit();
drawer_layout.closeDrawer(list_left_drawer);
}
}
~~~
代碼很簡(jiǎn)單,就不多說(shuō)了~
* * *
### 示例2.左右兩個(gè)側(cè)滑菜單的實(shí)現(xiàn)
> 嗯,不知道你有沒(méi)有發(fā)現(xiàn),從上面的DrawerLayout的布局,我們大概可以猜到,DrawerLayout 最多由三個(gè)部分組成,中間的內(nèi)容部分,左邊的側(cè)滑菜單部分,右邊的側(cè)滑菜單部分組成! 下面我們來(lái)寫一個(gè)帶有兩個(gè)側(cè)滑菜單的示例!
**運(yùn)行效果圖**:

**代碼實(shí)現(xiàn)**:
首先我們創(chuàng)建兩個(gè)Fragment以及對(duì)應(yīng)的布局,他們分別是左右側(cè)滑菜單!
**左邊Fragment**:
布局:**fg_left.xml**,這里就用了一個(gè)圖片而以,點(diǎn)擊后彈出一個(gè)新的Activity; 當(dāng)然你可以根據(jù)自己的需求進(jìn)行擴(kuò)展!
~~~
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/img_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/bg_menu_left"/>
</LinearLayout>
~~~
對(duì)應(yīng)的**LeftFragment.java**:
~~~
/**
* Created by Jay on 2015/10/9 0009.
*/
public class LeftFragment extends Fragment{
private DrawerLayout drawer_layout;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fg_left, container, false);
ImageView img_bg = (ImageView) view.findViewById(R.id.img_bg);
img_bg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getActivity().startActivity(new Intent(getActivity(),OtherActivity.class));
drawer_layout.closeDrawer(Gravity.START);
}
});
return view;
}
//暴露給Activity,用于傳入DrawerLayout,因?yàn)辄c(diǎn)擊后想關(guān)掉DrawerLayout
public void setDrawerLayout(DrawerLayout drawer_layout){
this.drawer_layout = drawer_layout;
}
}
~~~
**右面的Fragment**:
布局就三個(gè)按鈕,點(diǎn)擊后替換中間部分的Fragment,布局**fg_right.xml**代碼如下:
~~~
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#2F9AF2"
android:gravity="center"
android:orientation="vertical">
<Button
android:id="@+id/btn_one"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="菜單項(xiàng)一" />
<Button
android:id="@+id/btn_two"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="菜單項(xiàng)二" />
<Button
android:id="@+id/btn_three"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="菜單項(xiàng)三" />
</LinearLayout>
~~~
然后對(duì)應(yīng)的是**RightFragment.java**:
~~~
/**
* Created by Jay on 2015/10/9 0009.
*/
public class RightFragment extends Fragment implements View.OnClickListener{
private DrawerLayout drawer_layout;
private FragmentManager fManager;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fg_right, container, false);
view.findViewById(R.id.btn_one).setOnClickListener(this);
view.findViewById(R.id.btn_two).setOnClickListener(this);
view.findViewById(R.id.btn_three).setOnClickListener(this);
fManager = getActivity().getSupportFragmentManager();
return view;
}
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.btn_one:
ContentFragment cFragment1 = new ContentFragment("1.點(diǎn)擊了右側(cè)菜單項(xiàng)一",R.color.blue);
fManager.beginTransaction().replace(R.id.fly_content,cFragment1).commit();
drawer_layout.closeDrawer(Gravity.END);
break;
case R.id.btn_two:
ContentFragment cFragment2 = new ContentFragment("2.點(diǎn)擊了右側(cè)菜單項(xiàng)二",R.color.red);
fManager.beginTransaction().replace(R.id.fly_content,cFragment2).commit();
drawer_layout.closeDrawer(Gravity.END);
break;
case R.id.btn_three:
ContentFragment cFragment3 = new ContentFragment("3.點(diǎn)擊了右側(cè)菜單項(xiàng)三",R.color.yellow);
fManager.beginTransaction().replace(R.id.fly_content,cFragment3).commit();
drawer_layout.closeDrawer(Gravity.END);
break;
}
}
public void setDrawerLayout(DrawerLayout drawer_layout){
this.drawer_layout = drawer_layout;
}
}
~~~
另外還有一個(gè)中間部分填充的ContentFragment,布局:**fg_content.xml**如下:
~~~
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/tv_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:textSize="25sp" />
</RelativeLayout>
~~~
**ContentFragment.java**:
~~~
public class ContentFragment extends Fragment {
private TextView tv_content;
private String strContent;
private int bgColor;
public ContentFragment(String strContent,int bgColor) {
this.strContent = strContent;
this.bgColor = bgColor;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fg_content, container, false);
view.setBackgroundColor(getResources().getColor(bgColor));
tv_content = (TextView) view.findViewById(R.id.tv_content);
tv_content.setText(strContent);
return view;
}
}
~~~
編寫好以后,就到我們的Activity的布局了以及Activity的代碼了: 在此之前我們還需要些一個(gè)頂部條形欄的布局:
**view_topbar.xml**:
~~~
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#DCDEDB">
<Button
android:id="@+id/btn_right"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:background="@drawable/btn_selctor"/>
</RelativeLayout>
~~~
然后是**activity_main.xml**:
~~~
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include
android:id="@+id/topbar"
layout="@layout/view_topbar"
android:layout_width="wrap_content"
android:layout_height="48dp" />
<FrameLayout
android:id="@+id/fly_content"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<fragment
android:id="@+id/fg_left_menu"
android:name="jay.com.drawerlayoutdemo2.LeftFragment"
android:layout_width="300dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:tag="LEFT"
tools:layout="@layout/fg_left" />
<fragment
android:id="@+id/fg_right_menu"
android:name="jay.com.drawerlayoutdemo2.RightFragment"
android:layout_width="100dp"
android:layout_height="match_parent"
android:layout_gravity="end"
android:tag="RIGHT"
tools:layout="@layout/fg_right" />
</android.support.v4.widget.DrawerLayout>
~~~
最后是**MainActivity.java**:
~~~
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private DrawerLayout drawer_layout;
private FrameLayout fly_content;
private View topbar;
private Button btn_right;
private RightFragment fg_right_menu;
private LeftFragment fg_left_menu;
private FragmentManager fManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
fManager = getSupportFragmentManager();
fg_right_menu = (RightFragment) fManager.findFragmentById(R.id.fg_right_menu);
fg_left_menu = (LeftFragment) fManager.findFragmentById(R.id.fg_left_menu);
initViews();
}
private void initViews() {
drawer_layout = (DrawerLayout) findViewById(R.id.drawer_layout);
fly_content = (FrameLayout) findViewById(R.id.fly_content);
topbar = findViewById(R.id.topbar);
btn_right = (Button) topbar.findViewById(R.id.btn_right);
btn_right.setOnClickListener(this);
//設(shè)置右面的側(cè)滑菜單只能通過(guò)編程來(lái)打開
drawer_layout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED,
Gravity.END);
drawer_layout.setDrawerListener(new DrawerLayout.DrawerListener() {
@Override
public void onDrawerSlide(View view, float v) {
}
@Override
public void onDrawerOpened(View view) {
}
@Override
public void onDrawerClosed(View view) {
drawer_layout.setDrawerLockMode(
DrawerLayout.LOCK_MODE_LOCKED_CLOSED, Gravity.END);
}
@Override
public void onDrawerStateChanged(int i) {
}
});
fg_right_menu.setDrawerLayout(drawer_layout);
fg_left_menu.setDrawerLayout(drawer_layout);
}
@Override
public void onClick(View v) {
drawer_layout.openDrawer(Gravity.RIGHT);
drawer_layout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED,
Gravity.END); //解除鎖定
}
}
~~~
* * *
好的,至此就大功告成了~,呼呼,下面說(shuō)下看代碼時(shí)可能會(huì)有的疑惑:
> * **1**. drawer_layout.**openDrawer**(Gravity.END);
> 這句是設(shè)置打開的哪個(gè)菜單START代表左邊,END代表右邊
> * **2**. drawer_layout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED,Gravity.END); 鎖定右面的側(cè)滑菜單,不能通過(guò)手勢(shì)關(guān)閉或者打開,只能通過(guò)代碼打開!即調(diào)用openDrawer方法! 接著 drawer_layout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED,Gravity.END); 解除鎖定狀態(tài),即可以通過(guò)手勢(shì)關(guān)閉側(cè)滑菜單 最后在drawer關(guān)閉的時(shí)候調(diào)用: drawer_layout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, Gravity.END); 再次鎖定右邊的側(cè)滑菜單!
> * **3**. 布局代碼中的Tag屬性的作用? 答:這里沒(méi)用到,在重寫DrawerListener的onDrawerSlide方法時(shí),我們可以通過(guò)他的第一個(gè) 參數(shù)drawerView,調(diào)用drawerView.getTag().equals("START")判斷觸發(fā)菜單事件的是哪個(gè) 菜單!然后可以進(jìn)行對(duì)應(yīng)的操作!
* * *
## 3.代碼示例下載
[DrawerLayoutDemo.zip](http://www.runoob.com/wp-content/uploads/2015/10/DrawerLayoutDemo.zip)
[DrawerLayoutDemo2.zip](http://www.runoob.com/wp-content/uploads/2015/10/DrawerLayoutDemo2.zip)
* * *
## 本節(jié)小結(jié):
> 好的,本節(jié)給大家介紹了官方的側(cè)滑控件DrawerLayout的基本用法,使用起來(lái)非常的方便! 當(dāng)然這里僅僅是簡(jiǎn)單的使用演示,另外看到弘揚(yáng)大神寫過(guò)一篇:?[Android DrawerLayout 高仿QQ5.2雙向側(cè)滑菜單](http://blog.csdn.net/lmj623565791/article/details/41531475)?有興趣可以看看,如果看完本節(jié)的內(nèi)容,相信你看起來(lái)不會(huì)怎么吃力~好的!
>
> 本節(jié)就到這里,跟UI控件這一章說(shuō)拜拜了~下一章我們開始繪圖與動(dòng)畫了, 為我們進(jìn)階部分的自定義控件系列打基礎(chǔ)!
- 第一章——環(huán)境搭建和開發(fā)相關(guān)
- 1.0 Android基礎(chǔ)入門教程
- 1.1 背景相關(guān)與系統(tǒng)架構(gòu)分析
- 1.2 開發(fā)環(huán)境搭建
- 1.2.1 使用Eclipse + ADT + SDK開發(fā)Android APP
- 1.2.2 使用Android Studio開發(fā)Android APP
- 1.3 SDK更新不了問(wèn)題解決
- 1.4 Genymotion模擬器安裝
- 1.5 GIT教程
- 1.5.1 Git使用教程之本地倉(cāng)庫(kù)的基本操作
- 1.5.2 Git之使用GitHub搭建遠(yuǎn)程倉(cāng)庫(kù)
- 1.6 .9(九妹)圖片怎么玩
- 1.7 界面原型設(shè)計(jì)
- 1.8 工程相關(guān)解析(各種文件,資源訪問(wèn))
- 1.9 Android程序簽名打包
- 1.11 反編譯APK獲取代碼&資源
- 第二章——Android中的UI組件的詳解
- 2.1 View與ViewGroup的概念
- 2.2 布局
- 2.2.1 LinearLayout(線性布局)
- 2.2.2 RelativeLayout(相對(duì)布局)
- 2.2.3 TableLayout(表格布局)
- 2.2.4 FrameLayout(幀布局)
- 2.2.5 GridLayout(網(wǎng)格布局)
- 2.2.6 AbsoluteLayout(絕對(duì)布局)
- 2.3 表單
- 2.3.1 TextView(文本框)詳解
- 2.3.2 EditText(輸入框)詳解
- 2.3.3 Button(按鈕)與ImageButton(圖像按鈕)
- 2.3.4 ImageView(圖像視圖)
- 2.3.5.RadioButton(單選按鈕)&Checkbox(復(fù)選框)
- 2.3.6 開關(guān)按鈕ToggleButton和開關(guān)Switch
- 2.3.7 ProgressBar(進(jìn)度條)
- 2.3.8 SeekBar(拖動(dòng)條)
- 2.3.9 RatingBar(星級(jí)評(píng)分條)
- 2.4 控件
- 2.4.1 ScrollView(滾動(dòng)條)
- 2.4.2 Date & Time組件(上)
- 2.4.3 Date & Time組件(下)
- 2.4.4 Adapter基礎(chǔ)講解
- 2.4.5 ListView簡(jiǎn)單實(shí)用
- 2.4.6 BaseAdapter優(yōu)化
- 2.4.7ListView的焦點(diǎn)問(wèn)題
- 2.4.8 ListView之checkbox錯(cuò)位問(wèn)題解決
- 2.4.9 ListView的數(shù)據(jù)更新問(wèn)題
- 2.5 Adapter類控件
- 2.5.0 構(gòu)建一個(gè)可復(fù)用的自定義BaseAdapter
- 2.5.1 ListView Item多布局的實(shí)現(xiàn)
- 2.5.2 GridView(網(wǎng)格視圖)的基本使用
- 2.5.3 Spinner(列表選項(xiàng)框)的基本使用
- 2.5.4 AutoCompleteTextView(自動(dòng)完成文本框)的基本使用
- 2.5.5 ExpandableListView(可折疊列表)的基本使用
- 2.5.6 ViewFlipper(翻轉(zhuǎn)視圖)的基本使用
- 2.5.7 Toast(吐司)的基本使用
- 2.5.8 Notification(狀態(tài)欄通知)詳解
- 2.5.9 AlertDialog(對(duì)話框)詳解
- 2.6 對(duì)話框控件
- 2.6.0 其他幾種常用對(duì)話框基本使用
- 2.6.1 PopupWindow(懸浮框)的基本使用
- 2.6.2 菜單(Menu)
- 2.6.3 ViewPager的簡(jiǎn)單使用
- 2.6.4 DrawerLayout(官方側(cè)滑菜單)的簡(jiǎn)單使用
- 第三章——Android的事件處理機(jī)制
- 3.1.1 基于監(jiān)聽的事件處理機(jī)制
- 3.2 基于回調(diào)的事件處理機(jī)制
- 3.3 Handler消息傳遞機(jī)制淺析
- 3.4 TouchListener PK OnTouchEvent + 多點(diǎn)觸碰
- 3.5 監(jiān)聽EditText的內(nèi)容變化
- 3.6 響應(yīng)系統(tǒng)設(shè)置的事件(Configuration類)
- 3.7 AnsyncTask異步任務(wù)
- 3.8 Gestures(手勢(shì))
- 第四章——Android的四大組件
- 4.1.1 Activity初學(xué)乍練
- 4.1.2 Activity初窺門徑
- 4.1.3 Activity登堂入室
- 4.2.1 Service初涉
- 4.2.2 Service進(jìn)階
- 4.2.3 Service精通
- 4.3.1 BroadcastReceiver牛刀小試
- 4.3.2 BroadcastReceiver庖丁解牛
- 4.4.1 ContentProvider初探
- 4.4.2 ContentProvider再探——Document Provider
- 4.5.1 Intent的基本使用
- 4.5.2 Intent之復(fù)雜數(shù)據(jù)的傳遞
- 第五章——Fragment(碎片)
- 5.1 Fragment基本概述
- 5.2.1 Fragment實(shí)例精講——底部導(dǎo)航欄的實(shí)現(xiàn)(方法1)
- 5.2.2 Fragment實(shí)例精講——底部導(dǎo)航欄的實(shí)現(xiàn)(方法2)
- 5.2.3 Fragment實(shí)例精講——底部導(dǎo)航欄的實(shí)現(xiàn)(方法3)
- 5.2.4 Fragment實(shí)例精講——底部導(dǎo)航欄+ViewPager滑動(dòng)切換頁(yè)面
- 5.2.5 Fragment實(shí)例精講——新聞(購(gòu)物)類App列表Fragment的簡(jiǎn)單實(shí)現(xiàn)
- 第六章——Android數(shù)據(jù)存儲(chǔ)與訪問(wèn)
- 6.1 數(shù)據(jù)存儲(chǔ)與訪問(wèn)之——文件存儲(chǔ)讀寫
- 6.2 數(shù)據(jù)存儲(chǔ)與訪問(wèn)之——SharedPreferences保存用戶偏好參數(shù)
- 6.3.1 數(shù)據(jù)存儲(chǔ)與訪問(wèn)之——初見(jiàn)SQLite數(shù)據(jù)庫(kù)
- 6.3.2 數(shù)據(jù)存儲(chǔ)與訪問(wèn)之——又見(jiàn)SQLite數(shù)據(jù)庫(kù)
- 第七章——Android網(wǎng)絡(luò)編程
- 7.1.1 Android網(wǎng)絡(luò)編程要學(xué)的東西與Http協(xié)議學(xué)習(xí)
- 7.1.2 Android Http請(qǐng)求頭與響應(yīng)頭的學(xué)習(xí)
- 7.1.3 Android HTTP請(qǐng)求方式:HttpURLConnection
- 7.1.4 Android HTTP請(qǐng)求方式:HttpClient
- 7.2.1 Android XML數(shù)據(jù)解析
- 7.2.2 Android JSON數(shù)據(jù)解析
- 7.3.1 Android 文件上傳
- 7.3.2 Android 文件下載(1)
- 7.3.3 Android 文件下載(2)
- 7.4 Android 調(diào)用 WebService
- 7.5.1 WebView(網(wǎng)頁(yè)視圖)基本用法
- 7.5.2 WebView和JavaScrip交互基礎(chǔ)
- 7.5.3 Android 4.4后WebView的一些注意事項(xiàng)
- 7.5.4 WebView文件下載
- 7.5.5 WebView緩存問(wèn)題
- 7.5.6 WebView處理網(wǎng)頁(yè)返回的錯(cuò)誤碼信息
- 7.6.1 Socket學(xué)習(xí)網(wǎng)絡(luò)基礎(chǔ)準(zhǔn)備
- 7.6.2 基于TCP協(xié)議的Socket通信(1)
- 7.6.3 基于TCP協(xié)議的Socket通信(2)
- 7.6.4 基于UDP協(xié)議的Socket通信
- 第八章——Android繪圖與動(dòng)畫基礎(chǔ)
- 8.1.1 Android中的13種Drawable小結(jié) Part 1
- 8.1.2 Android中的13種Drawable小結(jié) Part 2
- 8.1.3 Android中的13種Drawable小結(jié) Part 3
- 8.2.1 Bitmap(位圖)全解析 Part 1
- 8.2.2 Bitmap引起的OOM問(wèn)題
- 8.3.1 三個(gè)繪圖工具類詳解
- 8.3.2 繪圖類實(shí)戰(zhàn)示例
- 8.3.3 Paint API之—— MaskFilter(面具)
- 8.3.4 Paint API之—— Xfermode與PorterDuff詳解(一)
- 8.3.5 Paint API之—— Xfermode與PorterDuff詳解(二)
- 8.3.6 Paint API之—— Xfermode與PorterDuff詳解(三)
- 8.3.7 Paint API之—— Xfermode與PorterDuff詳解(四)
- 8.3.8 Paint API之—— Xfermode與PorterDuff詳解(五)
- 8.3.9 Paint API之—— ColorFilter(顏色過(guò)濾器)(1/3)
- 8.3.10 Paint API之—— ColorFilter(顏色過(guò)濾器)(2-3)
- 8.3.11 Paint API之—— ColorFilter(顏色過(guò)濾器)(3-3)
- 8.3.12 Paint API之—— PathEffect(路徑效果)
- 8.3.13 Paint API之—— Shader(圖像渲染)
- 8.3.14 Paint幾個(gè)枚舉/常量值以及ShadowLayer陰影效果
- 8.3.15 Paint API之——Typeface(字型)
- 8.3.16 Canvas API詳解(Part 1)
- 8.3.17 Canvas API詳解(Part 2)剪切方法合集
- 8.3.18 Canvas API詳解(Part 3)Matrix和drawBitmapMash
- 8.4.1 Android動(dòng)畫合集之幀動(dòng)畫
- 8.4.2 Android動(dòng)畫合集之補(bǔ)間動(dòng)畫
- 8.4.3 Android動(dòng)畫合集之屬性動(dòng)畫-初見(jiàn)
- 8.4.4 Android動(dòng)畫合集之屬性動(dòng)畫-又見(jiàn)
- 第九章——Android中的多媒體開發(fā)
- 9.1 使用SoundPool播放音效(Duang~)
- 9.2 MediaPlayer播放音頻與視頻
- 9.3 使用Camera拍照
- 9.4 使用MediaRecord錄音
- 第十章——系統(tǒng)服務(wù)
- 10.1 TelephonyManager(電話管理器)
- 10.2 SmsManager(短信管理器)
- 10.3 AudioManager(音頻管理器)
- 10.4 Vibrator(振動(dòng)器)
- 10.5 AlarmManager(鬧鐘服務(wù))
- 10.6 PowerManager(電源服務(wù))
- 10.7 WindowManager(窗口管理服務(wù))
- 10.8 LayoutInflater(布局服務(wù))
- 10.9 WallpaperManager(壁紙管理器)
- 10.10 傳感器專題(1)——相關(guān)介紹
- 10.11 傳感器專題(2)——方向傳感器
- 10.12 傳感器專題(3)——加速度/陀螺儀傳感器
- 10.12 傳感器專題(4)——其他傳感器了解
- 10.14 Android GPS初涉
- 第十一章——由來(lái)、答疑和資源
- 11.0《2015最新Android基礎(chǔ)入門教程》完結(jié)散花~
