android.widget.ExpandableListView的实例源码

项目:yyox    文件ExpandedListUtils.java   
public static void setExpandedListViewHeightBasedOnChildren(ExpandableListView listView,int groupPosition) {
    expandablelistadapter listadapter = listView.getexpandablelistadapter();
    if (listadapter == null) {
        return;
    }
    View listItem = listadapter.getChildView(groupPosition,true,null,listView);
    listItem.measure(0,0);
    int appendHeight = 0;
    for (int i = 0; i < listadapter.getChildrenCount(groupPosition); i++) {
        appendHeight += listItem.getMeasuredHeight();
    }
    ViewGroup.LayoutParams params = listView.getLayoutParams();
    params.height += appendHeight;
    listView.setLayoutParams(params);
}
项目:chromium-for-android-56-debug-video    文件RecentTabsPage.java   
/**
 * Constructor returns an instance of RecentTabsPage.
 *
 * @param activity The activity this view belongs to.
 * @param recentTabsManager The RecentTabsManager which provides the model data.
 */
public RecentTabsPage(Activity activity,RecentTabsManager recentTabsManager) {
    mActivity = activity;
    mRecentTabsManager = recentTabsManager;

    mTitle = activity.getResources().getString(R.string.recent_tabs);
    mThemeColor = ApiCompatibilityUtils.getColor(
            activity.getResources(),R.color.default_primary_color);
    mRecentTabsManager.setUpdatedCallback(this);
    LayoutInflater inflater = LayoutInflater.from(activity);
    mView = (ViewGroup) inflater.inflate(R.layout.recent_tabs_page,null);
    mListView = (ExpandableListView) mView.findViewById(R.id.odp_listview);
    mAdapter = buildAdapter(activity,recentTabsManager);
    mListView.setAdapter(mAdapter);
    mListView.setonChildClickListener(this);
    mListView.setGroupIndicator(null);
    mListView.setonGroupCollapseListener(this);
    mListView.setonGroupExpandListener(this);
    mListView.setonCreateContextMenuListener(this);

    mView.addOnAttachStatechangelistener(this);
    ApplicationStatus.registerStateListenerForActivity(this,activity);
    // {@link #mInForeground} will be updated once the view is attached to the window.

    onUpdated();
}
项目:GitHub    文件GoodsListActivity.java   
private void initExpandableListView() {
    group = new ArrayList<>();
    child = new ArrayList<>();
    //去掉认箭头
    listView.setGroupIndicator(null);
    addInfo("全部",new String[]{});
    addInfo("上衣",new String[]{"古风","和风","lolita","日常"});
    addInfo("下装",new String[]{"日常","泳衣","汉风","创意T恤"});
    addInfo("外套",new String[]{"汉风","古风","胖次","南瓜裤","日常"});

    // 这里是控制如果列表没有孩子菜单不展开的效果
    listView.setonGroupClickListener(new ExpandableListView.OnGroupClickListener() {
        @Override
        public boolean onGroupClick(ExpandableListView parent,View v,int groupPosition,long id) {
            if (child.get(groupPosition).isEmpty()) {// isEmpty没有
                return true;
            } else {
                return false;
            }
        }
    });
}
项目:yyox    文件OrderPackageDetailActivity.java   
@Override
public void setUIValue(OrderDetail orderDetailJson) {
    for (int i = 0; i < orderDetailJson.getMerchandiseList().size(); i++) {
        if (orderDetailJson.getMerchandiseList().size() != 1) {
            mExpandableListView.collapseGroup(i);
        } else {
            mExpandableListView.expandGroup(i);
        }
        mExpandableListView.setonGroupClickListener(new ExpandableListView.OnGroupClickListener() {
            @Override
            public boolean onGroupClick(ExpandableListView parent,long id) {
                if (orderDetailJson.getMerchandiseList().size() != 1) {
                    return false;
                } else {
                    return true;
                }
            }
        });
    }
}
项目:yyox    文件ExpandedListUtils.java   
public static void setCollapseListViewHeightBasedOnChildren(ExpandableListView listView,0);
    int appendHeight = 0;
    for (int i = 0; i < listadapter.getChildrenCount(groupPosition); i++) {
        appendHeight += listItem.getMeasuredHeight();
    }
    ViewGroup.LayoutParams params = listView.getLayoutParams();
    params.height -= appendHeight;
    listView.setLayoutParams(params);
}
项目:TimeTrix    文件FragmentTagNotes.java   
@Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated (savedInstanceState);
        ImageButton btnAddNotes = (ImageButton) getActivity ().findViewById (R.id.buttonAddNotesTags);
        btnAddNotes.setonClickListener (this);
        btnAddNotes.setVisibility (View.INVISIBLE);
//        ListView mListViewTag = (ListView) getActivity().findViewById(R.id.listNotesAll);

        mExpandableListViewTag = (ExpandableListView) getActivity ().findViewById (R.id.expandableListNotesTags);

        mArrayListTagNotes = new ArrayList<> ();
//        customAdapterTagNotes = new CustomAdapter(mArrayListTagNotes,getActivity(),tempString,mHandler);
        mCustomAdapterTags = new CustomAdapterTags (getActivity (),Integer.parseInt (mSectionIndex) + 1);
        mExpandableListViewTag.setTag (R.string.filename,mSectionIndex);
        mExpandableListViewTag.setTag (R.string.list_object,mArrayListTagNotes);
        mExpandableListViewTag.setAdapter (mCustomAdapterTags);
        mExpandableListViewTag.setItemsCanFocus (true);
        registerForContextMenu (mExpandableListViewTag);
        mSectionIndex = String.valueOf (mOnFragmentInteractionListener.getSectionIndex());
        populateListView ();

    }
项目:ywApplication    文件SearchFragment.java   
private void initView(View view) {
    expandableListView = (ExpandableListView) view.findViewById(R.id.search_listview);
    heardView = inflater.inflate(R.layout.search_item_heard_view,expandableListView,false);
    setclickListener(heardView);
    contantsAdapter = new ContantsAdapter(getActivity(),groupImgId,text,datas,numId);
    expandableListView.setAdapter(contantsAdapter);
    expandableListView.addHeaderView(heardView);
    expandableListView.setonGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
        @Override
        public void onGroupExpand(int groupPosition) {
            for (int i = 0; i <groupImgId.size() ; i++) {
                if (groupPosition !=i) {
                    expandableListView.collapseGroup(i);
                }
            }
        }
    });
}
项目:AssistantBySDK    文件IntroduceFragment.java   
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    inflater=LayoutInflater.from(getActivity());
    listadapter=new expandablelistadapter(getActivity());
    listView.setAdapter(listadapter);
    listView.setonGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {

        @Override
        public void onGroupExpand(int groupPosition) {
            for(int i = 0; i < listadapter.getGroupCount(); i++){
                if(i != groupPosition && listView.isGroupExpanded(i)){
                    listView.collapseGroup(i);
                }
            }
        }
    });
}
项目:easyfilemanager    文件RootsFragment.java   
public void onCurrentRootChanged() {
    if (mAdapter == null || mList == null) return;

    final RootInfo root = ((BaseActivity) getActivity()).getCurrentRoot();
    for (int i = 0; i < mAdapter.getGroupCount(); i++) {
        for (int j = 0; j < mAdapter.getChildrenCount(i); j++) {
            final Object item = mAdapter.getChild(i,j);
            if (item instanceof RootItem) {
                final RootInfo testRoot = ((RootItem) item).root;
                if (Objects.equal(testRoot,root)) {
                    try {
                        long id = ExpandableListView.getPackedPositionForChild(i,j);
                        int index = mList.getFlatListPosition(id);
                        //mList.setSelection(index);
                        mList.setItemChecked(index,true);
                    } catch (Exception e){
                        CrashReportingManager.logException(e);
                    }

                    return;
                }
            }
        }
    }
}
项目:easyfilemanager    文件RootsFragment.java   
private ArrayList<Long> getExpandedIds() {
    ExpandableListView list = mList;
    expandablelistadapter adapter = mAdapter;
    if (adapter != null) {
        int length = adapter.getGroupCount();
        ArrayList<Long> expandedIds = new ArrayList<Long>();
        for(int i=0; i < length; i++) {
            if(list.isGroupExpanded(i)) {
                expandedIds.add(adapter.getGroupId(i));
            }
        }
        return expandedIds;
    } else {
        return null;
    }
}
项目:chromium-for-android-56-debug-video    文件RecentTabsPage.java   
@Override
public void onCreateContextMenu(ContextMenu menu,ContextMenuInfo menuInfo) {
    // Would prefer to have this context menu view managed internal to RecentTabsGroupView
    // Unfortunately,setting either onCreateContextMenuListener or onLongClickListener
    // disables the native onClick (expand/collapse) behavIoUr of the group view.
    ExpandableListView.ExpandableListContextMenuInfo info =
            (ExpandableListView.ExpandableListContextMenuInfo) menuInfo;

    int type = ExpandableListView.getPackedPositionType(info.packedPosition);
    int groupPosition = ExpandableListView.getPackedPositionGroup(info.packedPosition);

    if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {
        mAdapter.getGroup(groupPosition).onCreateContextMenuForGroup(menu,mActivity);
    } else if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
        int childPosition = ExpandableListView.getPackedPositionChild(info.packedPosition);
        mAdapter.getGroup(groupPosition).onCreateContextMenuForChild(childPosition,menu,mActivity);
    }
}
项目:cat-is-a-dog    文件FollowingHabitsFragment.java   
/**
 * Instantiate our data sources with firebase and our list adapters / view bindings
 * @param inflater
 * @param container
 * @param savedInstanceState
 * @return
 */
@Nullable
@Override
public View onCreateView(LayoutInflater inflater,@Nullable ViewGroup container,Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_following_habits,container,false);

    ExpandableListView followingHabitsView =
            (ExpandableListView) view.findViewById(R.id.following_habits_list);

    String userId = CurrentUser.getInstance().getUserId();

    followingDataSource = new SocialDataSource(userId,SocialDataSource.UserType.FOLLOWING);
    followingDataSource.addobserver(this);
    following = followingDataSource.getSource();

    followingHabitsAdapter = new FollowingHabitslistadapter(
            getActivity(),following,followingHabitMap
            );

    followingHabitsView.setAdapter(followingHabitsAdapter);

    return view;
}
项目:expandableListviewDemo    文件MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    listView = (ExpandableListView) findViewById(R.id.expandableListView);
    listView.setGroupIndicator(null);
    /**
     * 初始化数据
     */
    initData();
    adapter = new ExAdapter(this,lines);
    listView.setAdapter(adapter);
    //遍历所有group,将所有项设置成认展开
    int groupCount = listView.getCount();
    for (int i = 0; i < groupCount; i++) {
        listView.expandGroup(i);
    }
}
项目:simple-share-android    文件RootsFragment.java   
@Override
public boolean onChildClick(ExpandableListView parent,int childPosition,long id) {
    final BaseActivity activity = BaseActivity.get(RootsFragment.this);
    final Item item = (Item) mAdapter.getChild(groupPosition,childPosition);
    if (item instanceof RootItem) {
            int index = parent.getFlatListPosition(ExpandableListView.getPackedPositionForChild(groupPosition,childPosition));
        parent.setItemChecked(index,true);
        activity.onRootPicked(((RootItem) item).root,true);
        Bundle params = new Bundle();
        params.putString("type",((RootItem) item).root.title);
        AnalyticsManager.logEvent("navigate",((RootItem) item).root,params);
    } else if (item instanceof AppItem) {
        activity.onAppPicked(((AppItem) item).info);
    } else {
        throw new IllegalStateException("UnkNown root: " + item);
    }
    return false;
}
项目:letv    文件VipFragment.java   
private void setRootView(ChannelHomeBean result,boolean isFromNet) {
    if (result != null) {
        this.mChannelHomeBean = result;
        if (!BaseTypeUtils.isListempty(this.mChannelHomeBean.searchWords)) {
            initFooterSearchView(this.mChannelHomeBean.searchWords);
        }
        setFocusView(this.mChannelHomeBean.focus);
        if (this.mChannelHomeBean.isshowtextMark) {
            setVipTipsView();
        }
        initTabView(result);
        finishLoading();
        this.mpullView.setPullToRefreshEnabled(true);
        ((ExpandableListView) this.mpullView.getRefreshableView()).setAdapter(this.mlistadapter);
        this.mlistadapter.setDataList((ExpandableListView) this.mpullView.getRefreshableView(),this.mChannelHomeBean,isFromNet);
    }
}
项目:simple-share-android    文件RootsFragment.java   
private ArrayList<Long> getExpandedIds() {
    ExpandableListView list = mList;
    expandablelistadapter adapter = mAdapter;
    if (adapter != null) {
        int length = adapter.getGroupCount();
        ArrayList<Long> expandedIds = new ArrayList<Long>();
        for(int i=0; i < length; i++) {
            if(list.isGroupExpanded(i)) {
                expandedIds.add(adapter.getGroupId(i));
            }
        }
        return expandedIds;
    } else {
        return null;
    }
}
项目:Android-BLE-to-Arduino    文件DeviceControlActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.gatt_services_characteristics);

    final Intent intent = getIntent();
    mDeviceName = intent.getStringExtra(EXTRAS_DEVICE_NAME);
    mDeviceAddress = intent.getStringExtra(EXTRAS_DEVICE_ADDRESS);

    // Sets up UI references.
    ((TextView) findViewById(R.id.device_address)).setText(mDeviceAddress);
    mGattServicesList = (ExpandableListView) findViewById(R.id.gatt_services_list);
    mGattServicesList.setonChildClickListener(servicesListClickListner);
    mConnectionState = (TextView) findViewById(R.id.connection_state);
    mdatafield = (TextView) findViewById(R.id.data_value);

    getActionBar().setTitle(mDeviceName);
    getActionBar().setdisplayHomeAsUpEnabled(true);
    Intent gattServiceIntent = new Intent(this,BluetoothLeService.class);
    bindService(gattServiceIntent,mServiceConnection,BIND_AUTO_CREATE);

    // ATTENTION: This was auto-generated to implement the App Indexing API.
    // See https://g.co/AppIndexing/AndroidStudio for more information.
    client = new Googleapiclient.Builder(this).addApi(AppIndex.API).build();
}
项目:FireFiles    文件RootsFragment.java   
@Override
public boolean onChildClick(ExpandableListView parent,params);
    } else if (item instanceof AppItem) {
        activity.onAppPicked(((AppItem) item).info);
    } else {
        throw new IllegalStateException("UnkNown root: " + item);
    }
    return false;
}
项目:letv    文件ChannelDetailexpandablelistadapter.java   
public void setDataList(ExpandableListView listView,ChannelHomeBean homeBean,boolean isFromNet) {
    if (homeBean != null && !BaseTypeUtils.isListempty(homeBean.block) && listView != null) {
        this.mList.clear();
        Iterator it = homeBean.block.iterator();
        while (it.hasNext()) {
            HomeBlock block = (HomeBlock) it.next();
            if (block != null && (!BaseTypeUtils.isListempty(block.list) || "2".equals(block.contentStyle))) {
                this.mList.add(block);
            }
        }
        this.mIsFromNet = isFromNet;
        if (BaseTypeUtils.getElementFromList(homeBean.block,homeBean.tabIndex) != null) {
            this.mStartRank = 1;
        } else {
            this.mStartRank = 0;
        }
        notifyDataSetChanged();
        for (int i = 0; i < getGroupCount(); i++) {
            listView.expandGroup(i);
        }
        listView.setGroupIndicator(null);
        listView.setonGroupClickListener(new 1(this));
        this.mIsRehreshVipData = true;
    }
}
项目:linkedout_procon    文件Profile.java   
@Override
public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    prefs = getContext().getSharedPreferences(STUDENT_PREFS,0);

    View view =  inflater.inflate(R.layout.fragment_profile,false);

    fillInData(view);

    // get the listview
    expListView = (ExpandableListView) view.findViewById(R.id.lvExp);

    prepareListData();
    listadapter = new expandablelistadapter(view.getContext(),listDataHeader,listDataChild);

    // setting list adapter
    expListView.setAdapter(listadapter);

    return view;
}
项目:Huochexing12306    文件A6OrderAty.java   
private void initViews() {
    mNavigationIndex = getIntent()
            .getIntExtra(EXTRA_PRE_LOAD_DATA_INDEX,0);
    llytOperate = (LinearLayout) findViewById(R.id.operate);
    btnCancel = (Button) findViewById(R.id.cancel);
    btnCancel.setonClickListener(this);
    btnPay = (Button) findViewById(R.id.pay);
    btnPay.setonClickListener(this);
    tvEmptyView = (TextView) findViewById(R.id.emptyView);
    lvOrders = (ExpandableListView) findViewById(R.id.orders);

    lvOrders.setEmptyView(tvEmptyView);
    LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
    View footerView = inflater.inflate(R.layout.fv_a6_order,null);
    lvOrders.addFooterView(footerView);
    mAdapter = new A6OrderExpandableAdapter(this,mLstODBInfos);
    lvOrders.setAdapter(mAdapter);

    // btnPay.setEnabled(false);
    setPanelGone(true);
}
项目:exciting-app    文件ExpandableHListPosition.java   
static ExpandableHListPosition obtainPosition(long packedPosition) {
    if (packedPosition == ExpandableListView.PACKED_POSITION_VALUE_NULL) {
        return null;
    }

    ExpandableHListPosition elp = getRecycledOrCreate();
    elp.groupPos = ExpandableListView.getPackedPositionGroup(packedPosition);
    if (ExpandableListView.getPackedPositionType(packedPosition) ==
            ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
        elp.type = CHILD;
        elp.childPos = ExpandableListView.getPackedPositionChild(packedPosition);
    } else {
        elp.type = GROUP;
    }
    return elp;
}
项目:Android-DFU-App    文件ExpandableListActivity.java   
/**
 * Updates the screen state (current list and other views) when the content changes.
 * 
 * @see android.support.v7.app.AppCompatActivity#onContentChanged()
 */
@Override
public void onContentChanged() {
    super.onContentChanged();
    View emptyView = findViewById(R.id.empty);
    mList = (ExpandableListView) findViewById(R.id.list);
    if (mList == null) {
        throw new RuntimeException(
                "Your content must have a ExpandableListView whose id attribute is " +
                        "'R.id.list'");
    }
    if (emptyView != null) {
        mList.setEmptyView(emptyView);
    }
    mList.setonChildClickListener(this);
    mList.setonGroupExpandListener(this);
    mList.setonGroupCollapseListener(this);

    if (mFinishedStart) {
        setlistadapter(mAdapter);
    }
    mFinishedStart = true;
}
项目:igrow-android    文件DeviceControlActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(com.igrow.android.R.layout.gatt_services_characteristics);

    final Intent intent = getIntent();
    mDeviceName = intent.getStringExtra(EXTRAS_DEVICE_NAME);
    mDeviceAddress = intent.getStringExtra(EXTRAS_DEVICE_ADDRESS);

    // Sets up UI references.
    ((TextView) findViewById(com.igrow.android.R.id.device_address)).setText(mDeviceAddress);
    mGattServicesList = (ExpandableListView) findViewById(com.igrow.android.R.id.gatt_services_list);
    mGattServicesList.setonChildClickListener(servicesListClickListner);
    mConnectionState = (TextView) findViewById(com.igrow.android.R.id.connection_state);
    mdatafield = (TextView) findViewById(com.igrow.android.R.id.data_value);

    getActionBar().setTitle(mDeviceName);
    getActionBar().setdisplayHomeAsUpEnabled(true);
    Intent gattServiceIntent = new Intent(this,BIND_AUTO_CREATE);
}
项目:simple-share-android    文件RootsFragment.java   
public void onCurrentRootChanged() {
    if (mAdapter == null || mList == null) return;

    final RootInfo root = ((BaseActivity) getActivity()).getCurrentRoot();
    for (int i = 0; i < mAdapter.getGroupCount(); i++) {
        for (int j = 0; j < mAdapter.getChildrenCount(i); j++) {
            final Object item = mAdapter.getChild(i,true);
                    } catch (Exception e){
                        CrashReportingManager.logException(e);
                    }

                    return;
                }
            }
        }
    }
}
项目:CIA    文件ViewHabitIntentTests.java   
/**
 * Select the first habit in the user's list
 * @return the name of the first habit
 */
private String loadHabit(){
    // expand the first category
    solo.clickOnView(((ExpandableListView)solo.getView(R.id.HabitTypeExpandableListView)).getAdapter().getView(0,null));
    solo.sleep(600);

    String habitName = (String) ((ExpandableListView)solo.getView(R.id.HabitTypeExpandableListView)).getAdapter().getItem(1);

    // click in the first habit in the category
    solo.clickInList(2,0);
    solo.sleep(1500);

    solo.assertCurrentActivity("wrong activity",HabitViewActivity.class);
    return habitName;
}
项目:ultrasonic    文件PullToRefreshExpandableListView.java   
@Override
protected ExpandableListView createRefreshableView(Context context,AttributeSet attrs) {
    final ExpandableListView lv;
    if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) {
        lv = new InternalExpandableListViewSDK9(context,attrs);
    } else {
        lv = new InternalExpandableListView(context,attrs);
    }

    // Set it to this so it can be used in ListActivity/ListFragment
    lv.setId(android.R.id.list);
    return lv;
}
项目:CustomListView    文件PullToRefreshExpandableListView.java   
@Override
protected ExpandableListView createRefreshableView(Context context,attrs);
    }

    // Set it to this so it can be used in ListActivity/ListFragment
    lv.setId(android.R.id.list);
    return lv;
}
项目:ywApplication    文件PullToRefreshExpandableListView.java   
@Override
protected ExpandableListView createRefreshableView(Context context,attrs);
    }

    // Set it to this so it can be used in ListActivity/ListFragment
    lv.setId(android.R.id.list);
    return lv;
}
项目:CSipSimple    文件WizardChooser.java   
@Override
public boolean onChildClick(ExpandableListView parent,long id) {
    Map<String,Object> data = childDatas.get(groupPosition).get(childPosition);
    String wizard_id = (String) data.get(WizardUtils.ID);

    Intent result = getIntent();
    result.putExtra(WizardUtils.ID,wizard_id);

    setResult(RESULT_OK,result);
    finish();

    return true;
}
项目:homebank_android    文件BudgetSummaryFragment.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater,@Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.category_list,false);
    expandableListView = (ExpandableListView) rootView.findViewById(R.id.expandable_category_list);
    addOnClickListeners();
    listadapter = new ExpandableCategoryAdapter(
            getActivity(),HomeActivity.xhb.getTopCategoriesForMonthlyBudget(HomeActivity.CURRENT_MONTH),HomeActivity.CURRENT_MONTH
    );
    expandableListView.setAdapter(listadapter);
    return rootView;
}
项目:easyfilemanager    文件RootsFragment.java   
@Override
public View onCreateView(
        LayoutInflater inflater,Bundle savedInstanceState) {

    final View view = inflater.inflate(R.layout.fragment_roots,false);
    mList = (ExpandableListView) view.findViewById(android.R.id.list);
    mList.setonChildClickListener(mItemListener);
    mList.setChoiceMode(ListView.CHOICE_MODE_SINGLE);

    displayMetrics metrics = new displayMetrics();
    getActivity().getwindowManager().getDefaultdisplay().getMetrics(metrics);
    int width = Utils.dpToPx(302);

    boolean rtl = Utils.isRTL();
    int leftPadding = rtl ? 10 : 50;
    int rightPadding = rtl ? 50 : 10;
    int leftWidth = width - Utils.dpToPx(leftPadding);
    int rightWidth = width - Utils.dpToPx(rightPadding);

    if(Utils.hasJellyBeanMR2()){
        mList.setIndicatorBoundsRelative(leftWidth,rightWidth);

    } else {
        mList.setIndicatorBounds(leftWidth,rightWidth);
    }
    return view;
}
项目:simple-share-android    文件RootsFragment.java   
private void restoreExpandedState(ArrayList<Long> expandedIds) {
    this.expandedIds = expandedIds;
    if (expandedIds != null) {
        ExpandableListView list = mList;
        expandablelistadapter adapter = mAdapter;
        if (adapter != null) {
            for (int i=0; i<adapter.getGroupCount(); i++) {
                long id = adapter.getGroupId(i);
                if (expandedIds.contains(id)) list.expandGroup(i);
            }
        }
    }
}
项目:easyfilemanager    文件RootsFragment.java   
@Override
public boolean onItemLongClick(AdapterView<?> parent,View view,int position,long id) {
    int itemType = ExpandableListView.getPackedPositionType(id);
    int childPosition;
    int groupPosition;

    if ( itemType == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
        childPosition = ExpandableListView.getPackedPositionChild(id);
        groupPosition = ExpandableListView.getPackedPositionGroup(id);
        final Item item = (Item) mAdapter.getChild(groupPosition,childPosition);
        if (item instanceof AppItem) {
            showAppDetails(((AppItem) item).info);
            return true;
        } else if (item instanceof BookmarkItem) {
            removeBookark((BookmarkItem)item);
            return true;
        }  else {
            return false;
        }

    } else if(itemType == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {
        groupPosition = ExpandableListView.getPackedPositionGroup(id);
        return false;

    } else {
        return false;
    }
}
项目:easyfilemanager    文件RootsFragment.java   
private void restoreExpandedState(ArrayList<Long> expandedIds) {
    this.expandedIds = expandedIds;
    if (expandedIds != null) {
        ExpandableListView list = mList;
        expandablelistadapter adapter = mAdapter;
        if (adapter != null) {
            for (int i=0; i<adapter.getGroupCount(); i++) {
                long id = adapter.getGroupId(i);
                if (expandedIds.contains(id)) list.expandGroup(i);
            }
        }
    }
}
项目:Hotspot-master-devp    文件PullToRefreshExpandableListView.java   
@Override
protected ExpandableListView createRefreshableView(Context context,attrs);
    }

    // Set it to this so it can be used in ListActivity/ListFragment
    lv.setId(android.R.id.list);
    return lv;
}
项目:NoticeDog    文件InBoxCursorAdapter.java   
private InBoxCursorAdapter(Context context,Cursor cursor,final ExpandableListView parent) {
    super(cursor,context);
    GuiceModule.get().injectMembers(this);
    this.context = context;
    this.parent = parent;
    SwipedismissListViewTouchListener touchListener = new SwipedismissListViewTouchListener(parent,new SwipedismissListViewTouchListener.dismissCallbacks() {
        public boolean candismiss(int position) {
            return true;
        }

        public void ondismiss(ListView listView,int[] reverseSortedPositions) {
            for (int reverseSortedPosition : reverseSortedPositions) {
                long packedPosition = parent.getExpandableListPosition(reverseSortedPosition);
                int type = ExpandableListView.getPackedPositionType(packedPosition);
                int groupPosition;
                if (type == 1) {
                    groupPosition = ExpandableListView.getPackedPositionGroup(packedPosition);
                    int childPosition = ExpandableListView.getPackedPositionChild(packedPosition);
                    Log.d(InBoxCursorAdapter.TAG,"Removing group = " + groupPosition + "  |  child = " + childPosition + "  |  global position = " + reverseSortedPosition);
                    InBoxCursorAdapter.this.inBoxManager.deleteMessage(InBoxCursorAdapter.this.inBoxManager.getMessageFromViewCursor(InBoxCursorAdapter.this.getChild(groupPosition,childPosition)));
                    InBoxCursorAdapter.this.reset();
                } else if (type == 0) {
                    groupPosition = ExpandableListView.getPackedPositionGroup(packedPosition);
                    Log.d(InBoxCursorAdapter.TAG,"Removing group = " + groupPosition + "  |  global position = " + reverseSortedPosition);
                    InBoxCursorAdapter.this.inBoxManager.deleteConversation(InBoxCursorAdapter.this.inBoxManager.getConversationFromViewCursor(InBoxCursorAdapter.this.getGroup(groupPosition)));
                    InBoxCursorAdapter.this.reset();
                }
            }
        }
    });
    touchListener.setSwipetodismissViewResourceId(R.id.swipe_to_dismiss_view);
    parent.setonTouchListener(touchListener);
    parent.setonScrollListener(touchListener.makeScrollListener());
    parent.setSelector(17170445);
}
项目:CustomAndroidOnesheeld    文件PullToRefreshExpandableListView.java   
@Override
protected ExpandableListView createRefreshableView(Context context,attrs);
    }

    // Set it to this so it can be used in ListActivity/ListFragment
    lv.setId(android.R.id.list);
    return lv;
}
项目:simple-share-android    文件RootsFragment.java   
@Override
public View onCreateView(
        LayoutInflater inflater,rightWidth);
    }
    return view;
}
项目:Veggietizer    文件Popup.java   
/**
 * Shows the popup that is opened when the user clicks on the info action button of a details page.
 * An {@link ExpandableListView} is used as a layout.
 *
 * @param context The context to show the popup in.
 * @param title The popup's title.
 * @param groups The expandable categories.
 * @param entries Each category in <code>groups</code> shows one entry when expanded.
 * @return The dialog.
 */
private static AlertDialog showDetailsInfo(Context context,String title,String[] groups,String[] entries,DialogInterface.OnClickListener onSubmitListener) {
    if (groups.length != entries.length) {
        throw new IllegalArgumentException();
    }

    // Custom title
    TextView customTitle = (TextView) LayoutInflater.from(context).inflate(R.layout.popup_title,null);
    customTitle.setText(title);

    View popupDetailsInfo = LayoutInflater.from(context)
            .inflate(R.layout.popup_details_info,null);
    ExpandableListView listViewDetailsInfo = (ExpandableListView)
            popupDetailsInfo.findViewById(R.id.expandablelistview_popup_details_info);
    expandablelistadapter adapter = createDetailsInfoAdapter(context,groups,entries);
    listViewDetailsInfo.setAdapter(adapter);

    AlertDialog.Builder popupBuilder = new AlertDialog.Builder(context);
    popupBuilder.setView(popupDetailsInfo)
            .setNeutralButton(R.string.ok,onSubmitListener)
            .setCustomTitle(customTitle);

    AlertDialog dialog = popupBuilder.create();
    dialog.show();

    Utility.setFont(FontManager.Font.ROBOTO_LIGHT,new TextView[]{
            customTitle
    });

    return dialog;
}

相关文章

买水果
比较全面的redis工具类
gson 反序列化到多态子类
java 版本的 mb_strwidth
JAVA 反转字符串的最快方法,大概比StringBuffer.reverse()性...
com.google.gson.internal.bind.ArrayTypeAdapter的实例源码...