Android ExpandableListView雙層嵌套實(shí)現(xiàn)三級樹形菜單
在Android開發(fā)中,列表可以說是最常見的了,一般都是使用ListView,當(dāng)涉及到二維數(shù)組時(shí),更多的使用到ExpandableListView,然而當(dāng)數(shù)據(jù)結(jié)構(gòu)比較復(fù)雜時(shí),就需要使用三級菜單或者更多級的菜單來顯示,這就讓人比較頭疼了,最近做的項(xiàng)目就涉及到了三級菜單,遇到了不少問題,雖然不夠完美,但是基本需求實(shí)現(xiàn)了,在此記錄一下。(之前見過有人使用ListView實(shí)現(xiàn)4級、5級甚至更多級菜單的,是在Adapter的數(shù)據(jù)源里定義的結(jié)構(gòu),根據(jù)等級縮進(jìn)左間距的倍數(shù),鏈接地址找不到了,有興趣的可以自己找找)
先上效果圖:
簡單介紹下重點(diǎn),為了簡便,把第一層ExpandableListView稱之為EListOne,相應(yīng)的Adapter稱之為AdpOne;第二層ExpandableListView稱之為EListTwo,相應(yīng)的Adapter稱之為AdpTwo。
首先第一個(gè)要處理的問題是在AdpOne的getChildView方法中,需要對EListTwo的高度進(jìn)行動(dòng)態(tài)計(jì)算,因?yàn)镋ListTwo展開和關(guān)閉時(shí)高度是不一樣的,所以要在EListTwo的setOnGroupExpandListener和setOnGroupCollapseListener方法中做相應(yīng)的處理:
/** * @author Apathy、恒 * * 子ExpandableListView展開時(shí),因?yàn)間roup只有一項(xiàng),所以子ExpandableListView的總高度= * (子ExpandableListView的child數(shù)量 + 1 )* 每一項(xiàng)的高度 * */ eListView.setOnGroupExpandListener(new OnGroupExpandListener() { @Override public void onGroupExpand(int groupPosition) { LayoutParams lp = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (child.getChildNames().size() + 1)* (int) mContext.getResources().getDimension(R.dimen.parent_expandable_list_height)); eListView.setLayoutParams(lp); } }); /** * @author Apathy、恒 * * 子ExpandableListView關(guān)閉時(shí),此時(shí)只剩下group這一項(xiàng),所以子ExpandableListView的總高度即為一項(xiàng)的高度 * */ eListView.setOnGroupCollapseListener(new OnGroupCollapseListener() { @Override public void onGroupCollapse(int groupPosition) { LayoutParams lp = new LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, (int) mContext .getResources().getDimension( R.dimen.parent_expandable_list_height)); eListView.setLayoutParams(lp); } });
只展示菜單肯定不是我們的最終需求,我們一般需要點(diǎn)擊菜單后進(jìn)行相應(yīng)的界面跳轉(zhuǎn)或者數(shù)據(jù)處理,所以就需要獲取所點(diǎn)擊的菜單精確下標(biāo),獲取方法很簡單,只需要定義一個(gè)接口,在AdpOne的getChildView方法中回調(diào)即可:
/** * @author Apathy、恒 * * 點(diǎn)擊子ExpandableListView子項(xiàng)時(shí),調(diào)用回調(diào)接口 * */ eListView.setOnChildClickListener(new OnChildClickListener() { @Override public boolean onChildClick(ExpandableListView arg0, View arg1, int groupIndex, int childIndex, long arg4) { if (mTreeViewClickListener != null) { mTreeViewClickListener.onClickPosition(groupPosition, childPosition, childIndex); } return false; } });
下面是完整的代碼:
MainActivity.java:
package com.heng.tree; import java.util.ArrayList; import com.heng.tree.R; import com.heng.tree.adapter.ParentAdapter; import com.heng.tree.adapter.ParentAdapter.OnChildTreeViewClickListener; import com.heng.tree.entity.ChildEntity; import com.heng.tree.entity.ParentEntity; import android.app.Activity; import android.content.Context; import android.graphics.Color; import android.os.Bundle; import android.widget.ExpandableListView; import android.widget.ExpandableListView.OnGroupExpandListener; import android.widget.Toast; /** * * @author Apathy、恒 * * <br/> * * @email shexiaoheng@163.com * * @blog * <a >http://blog.csdn.net/shexiaoheng</a > * * <br/> * <br/> * * @Detail 本Demo為ExpandableListView嵌套ExpandableListView實(shí)現(xiàn)三級菜單的例子 * * #ParentAdapter.OnChildTreeViewClickListener * * */ public class MainActivity extends Activity implements OnGroupExpandListener, OnChildTreeViewClickListener { private Context mContext; private ExpandableListView eList; private ArrayList<ParentEntity> parents; private ParentAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContext = this; setContentView(R.layout.activity_main); loadData(); initEList(); } /** * @author Apathy、恒 * * 初始化菜單數(shù)據(jù)源 * */ private void loadData() { parents = new ArrayList<ParentEntity>(); for (int i = 0; i < 10; i++) { ParentEntity parent = new ParentEntity(); parent.setGroupName("父類父分組第" + i + "項(xiàng)"); parent.setGroupColor(getResources().getColor( android.R.color.holo_red_light)); ArrayList<ChildEntity> childs = new ArrayList<ChildEntity>(); for (int j = 0; j < 8; j++) { ChildEntity child = new ChildEntity(); child.setGroupName("子類父分組第" + j + "項(xiàng)"); child.setGroupColor(Color.parseColor("#ff00ff")); ArrayList<String> childNames = new ArrayList<String>(); ArrayList<Integer> childColors = new ArrayList<Integer>(); for (int k = 0; k < 5; k++) { childNames.add("子類第" + k + "項(xiàng)"); childColors.add(Color.parseColor("#ff00ff")); } child.setChildNames(childNames); childs.add(child); } parent.setChilds(childs); parents.add(parent); } } /** * @author Apathy、恒 * * 初始化ExpandableListView * */ private void initEList() { eList = (ExpandableListView) findViewById(R.id.eList); eList.setOnGroupExpandListener(this); adapter = new ParentAdapter(mContext, parents); eList.setAdapter(adapter); adapter.setOnChildTreeViewClickListener(this); } /** * @author Apathy、恒 * * 點(diǎn)擊子ExpandableListView的子項(xiàng)時(shí),回調(diào)本方法,根據(jù)下標(biāo)獲取值來做相應(yīng)的操作 * */ @Override public void onClickPosition(int parentPosition, int groupPosition, int childPosition) { // do something String childName = parents.get(parentPosition).getChilds() .get(groupPosition).getChildNames().get(childPosition) .toString(); Toast.makeText( mContext, "點(diǎn)擊的下標(biāo)為: parentPosition=" + parentPosition + " groupPosition=" + groupPosition + " childPosition=" + childPosition + "\n點(diǎn)擊的是:" + childName, Toast.LENGTH_SHORT).show(); } /** * @author Apathy、恒 * * 展開一項(xiàng),關(guān)閉其他項(xiàng),保證每次只能展開一項(xiàng) * */ @Override public void onGroupExpand(int groupPosition) { for (int i = 0; i < parents.size(); i++) { if (i != groupPosition) { eList.collapseGroup(i); } } } }
ParentAdapter.java
package com.heng.tree.adapter; import java.util.ArrayList; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseExpandableListAdapter; import android.widget.ExpandableListView; import android.widget.ExpandableListView.OnChildClickListener; import android.widget.ExpandableListView.OnGroupCollapseListener; import android.widget.ExpandableListView.OnGroupExpandListener; import android.widget.AbsListView.LayoutParams; import android.widget.TextView; import com.heng.tree.R; import com.heng.tree.entity.ChildEntity; import com.heng.tree.entity.ParentEntity; /** * * @author Apathy、恒 * * 父類分組的適配器 * * <br/> * <br/> * * 方法 {@link #getChildView(int, int, boolean, View, ViewGroup)}<b><font * color='#ff00ff' size='2'>極其重要</font></b> * * */ public class ParentAdapter extends BaseExpandableListAdapter { private Context mContext;// 上下文 private ArrayList<ParentEntity> mParents;// 數(shù)據(jù)源 private OnChildTreeViewClickListener mTreeViewClickListener;// 點(diǎn)擊子ExpandableListView子項(xiàng)的監(jiān)聽 public ParentAdapter(Context context, ArrayList<ParentEntity> parents) { this.mContext = context; this.mParents = parents; } @Override public ChildEntity getChild(int groupPosition, int childPosition) { return mParents.get(groupPosition).getChilds().get(childPosition); } @Override public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Override public int getChildrenCount(int groupPosition) { return mParents.get(groupPosition).getChilds() != null ? mParents .get(groupPosition).getChilds().size() : 0; } @Override public View getChildView(final int groupPosition, final int childPosition, boolean isExpanded, View convertView, ViewGroup parent) { final ExpandableListView eListView = getExpandableListView(); ArrayList<ChildEntity> childs = new ArrayList<ChildEntity>(); final ChildEntity child = getChild(groupPosition, childPosition); childs.add(child); final ChildAdapter childAdapter = new ChildAdapter(this.mContext, childs); eListView.setAdapter(childAdapter); /** * @author Apathy、恒 * * 點(diǎn)擊子ExpandableListView子項(xiàng)時(shí),調(diào)用回調(diào)接口 * */ eListView.setOnChildClickListener(new OnChildClickListener() { @Override public boolean onChildClick(ExpandableListView arg0, View arg1, int groupIndex, int childIndex, long arg4) { if (mTreeViewClickListener != null) { mTreeViewClickListener.onClickPosition(groupPosition, childPosition, childIndex); } return false; } }); /** * @author Apathy、恒 * * 子ExpandableListView展開時(shí),因?yàn)間roup只有一項(xiàng),所以子ExpandableListView的總高度= * (子ExpandableListView的child數(shù)量 + 1 )* 每一項(xiàng)的高度 * */ eListView.setOnGroupExpandListener(new OnGroupExpandListener() { @Override public void onGroupExpand(int groupPosition) { LayoutParams lp = new LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, (child .getChildNames().size() + 1) * (int) mContext.getResources().getDimension( R.dimen.parent_expandable_list_height)); eListView.setLayoutParams(lp); } }); /** * @author Apathy、恒 * * 子ExpandableListView關(guān)閉時(shí),此時(shí)只剩下group這一項(xiàng), * 所以子ExpandableListView的總高度即為一項(xiàng)的高度 * */ eListView.setOnGroupCollapseListener(new OnGroupCollapseListener() { @Override public void onGroupCollapse(int groupPosition) { LayoutParams lp = new LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, (int) mContext .getResources().getDimension( R.dimen.parent_expandable_list_height)); eListView.setLayoutParams(lp); } }); return eListView; } /** * @author Apathy、恒 * * 動(dòng)態(tài)創(chuàng)建子ExpandableListView * */ public ExpandableListView getExpandableListView() { ExpandableListView mExpandableListView = new ExpandableListView( mContext); LayoutParams lp = new LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, (int) mContext .getResources().getDimension( R.dimen.parent_expandable_list_height)); mExpandableListView.setLayoutParams(lp); mExpandableListView.setDividerHeight(0);// 取消group項(xiàng)的分割線 mExpandableListView.setChildDivider(null);// 取消child項(xiàng)的分割線 mExpandableListView.setGroupIndicator(null);// 取消展開折疊的指示圖標(biāo) return mExpandableListView; } @Override public Object getGroup(int groupPosition) { return mParents.get(groupPosition); } @Override public int getGroupCount() { return mParents != null ? mParents.size() : 0; } @Override public long getGroupId(int groupPosition) { return groupPosition; } @Override public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { GroupHolder holder = null; if (convertView == null) { convertView = LayoutInflater.from(mContext).inflate( R.layout.parent_group_item, null); holder = new GroupHolder(convertView); convertView.setTag(holder); } else { holder = (GroupHolder) convertView.getTag(); } holder.update(mParents.get(groupPosition)); return convertView; } /** * @author Apathy、恒 * * Holder優(yōu)化 * */ class GroupHolder { private TextView parentGroupTV; public GroupHolder(View v) { parentGroupTV = (TextView) v.findViewById(R.id.parentGroupTV); } public void update(ParentEntity model) { parentGroupTV.setText(model.getGroupName()); parentGroupTV.setTextColor(model.getGroupColor()); } } @Override public boolean hasStableIds() { return false; } @Override public boolean isChildSelectable(int groupPosition, int childPosition) { return false; } /** * @author Apathy、恒 * * 設(shè)置點(diǎn)擊子ExpandableListView子項(xiàng)的監(jiān)聽 * */ public void setOnChildTreeViewClickListener( OnChildTreeViewClickListener treeViewClickListener) { this.mTreeViewClickListener = treeViewClickListener; } /** * @author Apathy、恒 * * 點(diǎn)擊子ExpandableListView子項(xiàng)的回調(diào)接口 * */ public interface OnChildTreeViewClickListener { void onClickPosition(int parentPosition, int groupPosition, int childPosition); } }
ChildAdapter.java
package com.heng.tree.adapter; import java.util.ArrayList; import com.heng.tree.R; import com.heng.tree.entity.ChildEntity; import android.content.Context; import android.graphics.Color; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseExpandableListAdapter; import android.widget.TextView; /** * * @author Apathy、恒 * * <br/> * <br/> * * 子類分組的適配器 * * <br/> * <br/> * * 方法{@link #isChildSelectable(int,int)} <b><font color='#ff00ff' * size='2'>必須返回true</font></b> * * */ public class ChildAdapter extends BaseExpandableListAdapter { private Context mContext;// 上下文 private ArrayList<ChildEntity> mChilds;// 數(shù)據(jù)源 public ChildAdapter(Context context, ArrayList<ChildEntity> childs) { this.mContext = context; this.mChilds = childs; } @Override public int getChildrenCount(int groupPosition) { return mChilds.get(groupPosition).getChildNames() != null ? mChilds .get(groupPosition).getChildNames().size() : 0; } @Override public String getChild(int groupPosition, int childPosition) { if (mChilds.get(groupPosition).getChildNames() != null && mChilds.get(groupPosition).getChildNames().size() > 0) return mChilds.get(groupPosition).getChildNames() .get(childPosition).toString(); return null; } @Override public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Override public View getChildView(int groupPosition, int childPosition, boolean isExpanded, View convertView, ViewGroup parent) { ChildHolder holder = null; if (convertView == null) { convertView = LayoutInflater.from(mContext).inflate( R.layout.child_child_item, null); holder = new ChildHolder(convertView); convertView.setTag(holder); } else { holder = (ChildHolder) convertView.getTag(); } holder.update(getChild(groupPosition, childPosition)); return convertView; } /** * @author Apathy、恒 * * Holder優(yōu)化 * */ class ChildHolder { private TextView childChildTV; public ChildHolder(View v) { childChildTV = (TextView) v.findViewById(R.id.childChildTV); } public void update(String str) { childChildTV.setText(str); childChildTV.setTextColor(Color.parseColor("#00ffff")); } } @Override public Object getGroup(int groupPosition) { if (mChilds != null && mChilds.size() > 0) return mChilds.get(groupPosition); return null; } @Override public int getGroupCount() { return mChilds != null ? mChilds.size() : 0; } @Override public long getGroupId(int groupPosition) { return groupPosition; } @Override public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { GroupHolder holder = null; if (convertView == null) { convertView = LayoutInflater.from(mContext).inflate( R.layout.child_group_item, null); holder = new GroupHolder(convertView); convertView.setTag(holder); } else { holder = (GroupHolder) convertView.getTag(); } holder.update(mChilds.get(groupPosition)); return convertView; } /** * @author Apathy、恒 * * Holder優(yōu)化 * */ class GroupHolder { private TextView childGroupTV; public GroupHolder(View v) { childGroupTV = (TextView) v.findViewById(R.id.childGroupTV); } public void update(ChildEntity model) { childGroupTV.setText(model.getGroupName()); childGroupTV.setTextColor(model.getGroupColor()); } } @Override public boolean hasStableIds() { return false; } @Override public boolean isChildSelectable(int groupPosition, int childPosition) { /** * ============================================== * 此處必須返回true,否則無法響應(yīng)子項(xiàng)的點(diǎn)擊事件=============== * ============================================== **/ return true; } }
CListAdapter.java
package com.heng.tree.adapter; import java.util.ArrayList; import com.heng.tree.R; import com.heng.tree.entity.ChildEntity; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; /** * * @author Apathy、恒 * * 子類子類列表的適配器 * * */ public class CListAdapter extends BaseAdapter { private Context mContext; private ArrayList<ChildEntity> mChilds; public CListAdapter(Context context, ArrayList<ChildEntity> childs) { this.mContext = context; this.mChilds = childs; } @Override public int getCount() { return mChilds != null ? mChilds.size() : 0; } @Override public Object getItem(int position) { if ((getCount() > 0) && (position > 0 && position < mChilds.size())) { return mChilds.get(position); } return null; } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { Holder holder = null; if (convertView == null) { convertView = LayoutInflater.from(mContext).inflate( R.layout.child_child_item, null); holder = new Holder(convertView); convertView.setTag(holder); } else { holder = (Holder) convertView.getTag(); } holder.update(mChilds.get(position).getGroupName()); return convertView; } class Holder { private TextView tv; public Holder(View v) { tv = (TextView) v.findViewById(R.id.childChildTV); } public void update(String text) { tv.setText(text); } } }
ParentEntity.java
package com.heng.tree.entity; import java.util.ArrayList; /** * * @author Apathy、恒 * * 子類分組的實(shí)體 * * */ public class ParentEntity { private int groupColor; private String groupName; private ArrayList<ChildEntity> childs; /* ========================================================== * ======================= get method ======================= * ========================================================== */ public int getGroupColor() { return groupColor; } public String getGroupName() { return groupName; } public ArrayList<ChildEntity> getChilds() { return childs; } /* ========================================================== * ======================= set method ======================= * ========================================================== */ public void setGroupColor(int groupColor) { this.groupColor = groupColor; } public void setGroupName(String groupName) { this.groupName = groupName; } public void setChilds(ArrayList<ChildEntity> childs) { this.childs = childs; } }
ChildEntity.java
package com.heng.tree.entity; import java.util.ArrayList; /** * * @author Apathy、恒 * * 父類分組的實(shí)體 * * */ public class ChildEntity { private int groupColor; private String groupName; private ArrayList<String> childNames; /* ========================================================== * ======================= get method ======================= * ========================================================== */ public int getGroupColor() { return groupColor; } public String getGroupName() { return groupName; } public ArrayList<String> getChildNames() { return childNames; } /* ========================================================== * ======================= set method ======================= * ========================================================== */ public void setGroupColor(int groupColor) { this.groupColor = groupColor; } public void setGroupName(String groupName) { this.groupName = groupName; } public void setChildNames(ArrayList<String> childNames) { this.childNames = childNames; } }
activity_main.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <ExpandableListView android:id="@+id/eList" android:layout_width="match_parent" android:layout_height="match_parent" android:groupIndicator="@null" /> </FrameLayout>
parent_group_item.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingLeft="@dimen/parent_expandable_list_group_padding_left" > <TextView android:id="@+id/parentGroupTV" android:layout_width="wrap_content" android:layout_height="@dimen/parent_expandable_list_height" android:gravity="center_vertical" /> </RelativeLayout>
child_group_item.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" > <RelativeLayout android:layout_width="match_parent" android:layout_height="@dimen/parent_expandable_list_height" > <TextView android:id="@+id/childGroupTV" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerVertical="true" android:paddingLeft="@dimen/child_expandable_list_group_padding_left" /> </RelativeLayout> </LinearLayout>
child_child_item.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" > <RelativeLayout android:layout_width="match_parent" android:layout_height="@dimen/parent_expandable_list_height" > <TextView android:id="@+id/childChildTV" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerVertical="true" android:paddingLeft="@dimen/child_expandable_list_child_padding_left" /> </RelativeLayout> </LinearLayout>
dimens.xml
<resources> <!-- Default screen margins, per the Android Design guidelines. --> <dimen name="parent_expandable_list_height">50dp</dimen> <dimen name="parent_expandable_list_group_padding_left">10dp</dimen> <dimen name="child_expandable_list_group_padding_left">40dp</dimen> <dimen name="child_expandable_list_child_padding_left">75dp</dimen> </resources>
點(diǎn)此下載demo
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- Android ExpandableListView實(shí)現(xiàn)下拉刷新和加載更多效果
- Android ExpandableListView單選以及多選實(shí)現(xiàn)代碼
- Android ScrollView嵌套ExpandableListView顯示不正常的問題的解決辦法
- Android listview ExpandableListView實(shí)現(xiàn)多選,單選,全選,edittext實(shí)現(xiàn)批量輸入的實(shí)例代碼
- Android 關(guān)于ExpandableListView刷新問題的解決方法
- Android 關(guān)于ExpandableListView去掉里頭分割線的方法
- Android UI控件ExpandableListView基本用法詳解
- Android改變ExpandableListView的indicator圖標(biāo)實(shí)現(xiàn)方法
- Android中ExpandableListView的用法實(shí)例
- Android ExpandableListView展開列表控件使用實(shí)例
- Android ExpandableListView用法示例詳解
相關(guān)文章
Android 開發(fā)使用PopupWindow實(shí)現(xiàn)加載等待界面功能示例
這篇文章主要介紹了Android 開發(fā)使用PopupWindow實(shí)現(xiàn)加載等待界面功能,結(jié)合實(shí)例形式分析了Android使用PopupWindow組件實(shí)現(xiàn)加載等待界面功能相關(guān)布局與功能實(shí)現(xiàn)技巧,需要的朋友可以參考下2020-05-05Android利用懸浮按鈕實(shí)現(xiàn)翻頁效果
這篇文章主要介紹了Android利用懸浮按鈕實(shí)現(xiàn)翻頁效果的相關(guān)資料,需要的朋友可以參考下2015-12-12Android使用MediaRecorder實(shí)現(xiàn)錄像功能
這篇文章主要為大家詳細(xì)介紹了Android使用MediaRecorder實(shí)現(xiàn)錄像功能,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-06-06Android ScrollView滑動(dòng)實(shí)現(xiàn)仿QQ空間標(biāo)題欄漸變
這篇文章主要為大家詳細(xì)介紹了Android ScrollView滑動(dòng)實(shí)現(xiàn)仿QQ空間標(biāo)題欄漸變,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-08-08Android自定義ScrollView使用自定義監(jiān)聽
這篇文章主要介紹了Android自定義ScrollView使用自定義監(jiān)聽 ,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-12-12Android中Activity生命周期和啟動(dòng)模式詳解
這篇文章主要介紹了Activity生命周期和啟動(dòng)模式詳解的相關(guān)資料,需要的朋友可以參考下2016-07-07深入理解Android中的Handler異步通信機(jī)制
這篇文章主要介紹了Android中的Handler異步通信機(jī)制,文中舉了兩個(gè)例子介紹了Handler里面實(shí)用的API中的方法,需要的朋友可以參考下2016-03-03