下面列出了android.widget.ExpandableListView#setOnGroupClickListener ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (view == null) {
DialogView.Initial(getActivity(), "正在加载好友列表......");
view = inflater.inflate(R.layout.fragment_friend, container, false);
map_is_open = new HashMap<>();
list_is_open = new ArrayList<>();
freshLayout = (SwipeRefreshLayout) view.findViewById(R.id.fragment_friend_swipe);
freshLayout.setOnRefreshListener(this);
freshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
android.R.color.holo_green_dark,
android.R.color.holo_red_light,
android.R.color.holo_orange_dark);
expandableListView = (ExpandableListView) view.findViewById(R.id.fragment_friend_expandableListView);
expandableListView.setOnGroupClickListener(this);
DialogView.show();
getData();
}
return view;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mlistView = new ExpandableListView(this);
mlistView.setOnGroupClickListener(this);
mlistView.setOnChildClickListener(this);
List<GroupList> groups = new ArrayList<GroupList>();
for( int i=0; i<mParentMenu.length; i++) {
List<GroupList> childs = new ArrayList<GroupList>();
for( int j=0; j<mChildMenu[i].length; j++ ) {
childs.add(new GroupListChild(mChildMenu[i][j]));
}
groups.add(new GroupListParent(mParentMenu[i],childs));
}
mAdapter = new GroupListAdapter(this,groups);
mlistView.setAdapter(mAdapter);
setContentView(mlistView);
}
/**
* {@inheritDoc}
*
* @see org.emdev.ui.AbstractActionActivity#onCreateImpl(android.os.Bundle)
*/
@Override
protected void onCreateImpl(final Bundle savedInstanceState) {
setContentView(R.layout.opds);
setActionForView(R.id.opdsaddfeed);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
final OPDSActivityController c = getController();
list = (ExpandableListView) findViewById(R.id.opdslist);
list.setGroupIndicator(null);
list.setChildIndicator(null);
list.setOnGroupClickListener(c);
list.setOnChildClickListener(c);
list.setAdapter(c.adapter);
this.registerForContextMenu(list);
}
private void init() {
mInflater = LayoutInflater.from(this);
initData();
mAdapter = new MyExpandableListViewAdapter();
mListView = (ExpandableListView) findViewById(R.id.my_list);
mListView.setAdapter(mAdapter);
mListView.setOnGroupClickListener(this);
mListView.setOnChildClickListener(this);
mListView.setOnGroupExpandListener(this);
}
private void testExpandListView() {
//可以参考 08 ListView & ExpaadableListView
ExpandableListView expandableListView = new ExpandableListView(this);
expandableListView.setOnGroupClickListener((expandableListView1, view, i, l) -> false);
expandableListView.setOnChildClickListener((expandableListView12, view, i, i1, l) -> false);
}