当前位置: 首页>>代码示例>>Java>>正文


Java OnGroupClickListener类代码示例

本文整理汇总了Java中android.widget.ExpandableListView.OnGroupClickListener的典型用法代码示例。如果您正苦于以下问题:Java OnGroupClickListener类的具体用法?Java OnGroupClickListener怎么用?Java OnGroupClickListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OnGroupClickListener类属于android.widget.ExpandableListView包,在下文中一共展示了OnGroupClickListener类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initListView

import android.widget.ExpandableListView.OnGroupClickListener; //导入依赖的package包/类
private void initListView() {
    this.mStarAdapter = new StarAdapter(this, this.mStarName);
    this.mStarAdapter.setStarBookCallback(this.mBooedkProgramsCallback);
    this.mListView.setAdapter(this.mStarAdapter);
    DisplayMetrics displayMetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
    int screenWidth = displayMetrics.widthPixels;
    this.mListView.setHeaderLayoutParams(new LayoutParams(screenWidth, (int) (9.0f * (((float) screenWidth) / 16.0f))));
    this.mListView.setScrollViewCallbacks(this);
    ((ExpandableListView) this.mListView.getRootView()).setGroupIndicator(null);
    ((ExpandableListView) this.mListView.getRootView()).setOnGroupClickListener(new OnGroupClickListener(this) {
        final /* synthetic */ StarActivity this$0;

        {
            if (HotFix.PREVENT_VERIFY) {
                System.out.println(VerifyLoad.class);
            }
            this.this$0 = this$0;
        }

        public boolean onGroupClick(ExpandableListView expandableListView, View view, int i, long l) {
            return true;
        }
    });
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:26,代码来源:StarActivity.java

示例2: initExpandListView

import android.widget.ExpandableListView.OnGroupClickListener; //导入依赖的package包/类
/**
 * 初始化可拓展列表
 */
private void initExpandListView() {
	statusAdapter = new ExpandLvAdapter(context, getListData());
	expandlistView.setAdapter(statusAdapter);
	expandlistView.setGroupIndicator(null); // 去掉默认带的箭头
	expandlistView.setSelection(0);// 设置默认选中项
	// 遍历所有group,将所有项设置成默认展开
	final int groupCount = expandlistView.getCount();
	for (int i = 0; i < groupCount; i++) {
		expandlistView.expandGroup(i);
	}

	expandlistView.setOnGroupClickListener(new OnGroupClickListener() {

		@Override
		public boolean onGroupClick(ExpandableListView parent, View v,
				int groupPosition, long id) {
			if(parent.isGroupExpanded(groupPosition)) {
				parent.collapseGroup(groupPosition);
			} else {
				parent.expandGroup(groupPosition);
			}
			return true;
		}
	});
}
 
开发者ID:sifeier,项目名称:One,代码行数:29,代码来源:ExpandLvActivity.java

示例3: onCreate

import android.widget.ExpandableListView.OnGroupClickListener; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);
	elv  = (ExpandableListView) findViewById(R.id.lvExp1);
	elv.setFocusable(false);
	
	/** 
	 * THIS CAN BE USED IN ACTIVITY OR FRAGMENTS
	 * **/
       		
	elv.setAdapter(new CustomELVAdapter(this, MainActivity.this, groupname, ImgBckgrnd, listinfo,data));
	
	
	
	elv.setOnGroupClickListener(new OnGroupClickListener() {

   		@Override
   		public boolean onGroupClick(ExpandableListView parent, View v,
   				int groupPosition, long id) {
   		   /** 
   		    * TODO:return true to enable group click
   		    */
   			
   			// DO SOMETHING
   			
   			return false;
   		}
   	});
	
     }
 
开发者ID:harishsn,项目名称:ExpandableListView,代码行数:32,代码来源:MainActivity.java

示例4: setOnGroupClickListener

import android.widget.ExpandableListView.OnGroupClickListener; //导入依赖的package包/类
/**
* @see ExpandableListView#setOnGroupClickListener(OnGroupClickListener)
*/
 public W setOnGroupClickListener(OnGroupClickListener onGroupClickListener) {
     mView.setOnGroupClickListener(onGroupClickListener);
     return (W) this;
 }
 
开发者ID:AnthZh,项目名称:AndroidViewHelper,代码行数:8,代码来源:ExpandableListViewWrapper.java

示例5: onCreateView

import android.widget.ExpandableListView.OnGroupClickListener; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) 
{
	view = inflater.inflate(R.layout.fragment_library, container, false);
	
	list = (ExpandableListView) view.findViewById(R.id.list);
  
	list.setOnGroupClickListener(new OnGroupClickListener() 
	{
           @Override
           public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) 
           {
           	if (list.isGroupExpanded(groupPosition))
           	{
           		return false;
           	}
           	else
           	{
           		if (artists == null) return true;
            	LibraryArtist artist = artists.get(groupPosition);
            	if (artist == null) return true;
            	
            	if (artist.getAlbums() == null)
            	{
            		try 
        			{
            			artist.initAlbums(app.oMPDAsyncHelper.oMPD.getAlbums(artist, true));
					} 
        			catch (MPDServerException e) 
        			{
        				artist.initAlbums(null);
						e.printStackTrace();
					}
            	}
            	
            	if (albumToDisplay != null)
        		{
        			privateDisplayAlbum(albumToDisplay, artist, groupPosition);
        			albumToDisplay = null;
        		}
            	
            	return false;
           	}
           }
       });
			
	loadingView = view.findViewById(R.id.loadingLayout);
    loadingTextView = (TextView) view.findViewById(R.id.loadingText);
    loadingTextView.setText(R.string.library_loading_artists);
    noResultView = view.findViewById(R.id.noResultLayout);
    	    
    pullToRefreshLayout = (PullToRefreshLayout) view.findViewById(R.id.pullToRefresh);
    
    lastPosition = -1;
	if (savedInstanceState != null) 
	{
		lastPosition = savedInstanceState.getInt(EXTRA_POSITION, 0);
	}
  
	return view;
}
 
开发者ID:thunderace,项目名称:mpd-control,代码行数:62,代码来源:LibraryFragment.java

示例6: onCreate

import android.widget.ExpandableListView.OnGroupClickListener; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    
    List<GroupItem> items = new ArrayList<GroupItem>();
    
    // Populate our list with groups and it's children
    for(int i = 1; i < 100; i++) {
        GroupItem item = new GroupItem();
        
        item.title = "Group " + i;
        
        for(int j = 0; j < i; j++) {
            ChildItem child = new ChildItem();
            child.title = "Awesome item " + j;
            child.hint = "Too awesome";
            
            item.items.add(child);
        }
        
        items.add(item);
    }
    
    adapter = new ExampleAdapter(this);
    adapter.setData(items);
    
    listView = (AnimatedExpandableListView) findViewById(R.id.listView);
    listView.setAdapter(adapter);
    
    // In order to show animations, we need to use a custom click handler
    // for our ExpandableListView.
    listView.setOnGroupClickListener(new OnGroupClickListener() {

        @Override
        public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
            // We call collapseGroupWithAnimation(int) and
            // expandGroupWithAnimation(int) to animate group 
            // expansion/collapse.
            if (listView.isGroupExpanded(groupPosition)) {
                listView.collapseGroupWithAnimation(groupPosition);
            } else {
                listView.expandGroupWithAnimation(groupPosition);
            }
            return true;
        }
        
    });
}
 
开发者ID:idunnololz,项目名称:AnimatedExpandableListView,代码行数:50,代码来源:MainActivity.java


注:本文中的android.widget.ExpandableListView.OnGroupClickListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。