91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

ExpandableList一種可以伸展收縮的listview

發布時間:2020-07-16 11:57:30 來源:網絡 閱讀:1282 作者:釣伯樂 欄目:開發技術
public class OrderingExpandAdapter extends BaseExpandableListAdapter {
    public OrderingExpandAdapter(Context ctx, ArrayList<String> groupTitle,
            List<List> list, Handler handler) {
        mContext = ctx;
        mSize = BitmapUtils.getSize(ctx, 60);
        mInflater = (LayoutInflater) mContext
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        mHandler = handler;
        initImageLoader();
        setData(groupTitle, list);
    }
    private void setData(ArrayList<String> groupTitle, List<List> list) {
        if (groupTitle == null) {
            mGroupList = new ArrayList<String>();
        } else {
            mGroupList = groupTitle;
        }
        if (list == null) {
            mData = new ArrayList<List>();
        } else {
            mData = list;
        }
    }
    public void refreshData(ArrayList<String> groupTitle, List<List> list) {
        setData(groupTitle, list);
        notifyDataSetChanged();
    }
    public void refreshData(List<List> list) {
        setData(mGroupList, list);
        notifyDataSetChanged();
    }
    public void refreshData() {
        notifyDataSetChanged();
    }
    private void initImageLoader() {
        mImageLoader = ImageLoader.getInstance();
        options = new DisplayImageOptions.Builder()
        .showImageOnLoading(R.drawable.ic_stub)
        .showImageForEmptyUri(R.drawable.ic_empty)
        .showImageOnFail(R.drawable.ic_error).cacheInMemory(true)
        .cacheOnDisc(true).considerExifParams(true)
        .displayer(new SimpleBitmapDisplayer()).build();
    }
    public void setData(List<List> list) {
        mData = list;
    }
    @Override
    public int getGroupCount() {
        // TODO Auto-generated method stub
        return mData.size();
    }
    @Override
    public int getChildrenCount(int groupPosition) {
        // TODO Auto-generated method stub
        return mData.get(groupPosition).size();
    }
    @Override
    public List getGroup(int groupPosition) {
        // TODO Auto-generated method stub
        return mData.get(groupPosition);
    }
    @Override
    public Object getChild(int groupPosition, int childPosition) {
        // TODO Auto-generated method stub
        return mData.get(groupPosition).get(childPosition);
    }
    @Override
    public long getGroupId(int groupPosition) {
        // TODO Auto-generated method stub
        return groupPosition;
    }
    @Override
    public long getChildId(int groupPosition, int childPosition) {
        // TODO Auto-generated method stub
        return childPosition;
    }
    @Override
    public boolean hasStableIds() {
        // TODO Auto-generated method stub
        return false;
    }
//groupview中需要布局復用
    @Override
    public View getGroupView(int groupPosition, boolean isExpanded,
            View convertView, ViewGroup parent) {
        // TODO Auto-generated method stub
        GroupViewHolder holder = null;
        if (convertView == null) {
            holder = new GroupViewHolder();
            convertView = mInflater.inflate(R.layout.auto_ordering_group_item,
                    null);
            // }
            holder.mGroupName = (TextView) convertView
                    .findViewById(R.id.tvgroupname);
            holder.mImageView = (ImageView) convertView
                    .findViewById(R.id.ivorderarrow);
            convertView.setTag(R.layout.auto_ordering_group_item, holder);
        } else {
            holder = (GroupViewHolder) convertView
                    .getTag(R.layout.auto_ordering_group_item);
        }
        if (mGroupList != null) {
            holder.mGroupName.setText(mGroupList.get(groupPosition));
        }
        if (isExpanded) {
            holder.mImageView
                    .setBackgroundResource(R.drawable.order_arrow_down);
        } else {
            holder.mImageView
                    .setBackgroundResource(R.drawable.order_arrow_right);
        }
        return convertView;
    }
//childview中需要布局復用
    @Override
    public View getChildView(int groupPosition, int childPosition,
            boolean isLastChild, View convertView, ViewGroup parent) {
        ChildViewHolder holder = null;
//這里判斷 不僅要判斷convertView為空還要判斷 getTag方面獲得布局復用為空
        if (convertView == null
                || null == (ChildViewHolder) convertView.getTag(R.id.idkey0
                        + (groupPosition+1)*1000+childPosition)) {
            holder = new ChildViewHolder();
            convertView = mInflater.inflate(R.layout.auto_ordering_child_item,
                    null);
            // }
              initViewHolder();
// setTag(key,value);鍵值對模式 使用
//key 要注意 必須再res/value/ids 中聲明定義
            convertView.setTag(R.id.idkey0 +  (groupPosition+1)*1000+childPosition, holder);
        } else {
            holder = (ChildViewHolder) convertView.getTag(R.id.idkey0
                    +  (groupPosition+1)*1000+childPosition);
        }
          initViewDataHolder();
        return convertView;
    }
    @Override
    public boolean isChildSelectable(int groupPosition, int childPosition) {
        // TODO Auto-generated method stub
        /* 很重要:實現ChildView點擊事件,必須返回true */
        return false;
    }
    private class GroupViewHolder {
        ImageView mImageView;
        TextView mGroupName;
    }
    private class ChildViewHolder {
        // iv/ivmoreshoptitle/rlsurplustime/tvsurplustime/tvtitle/tvnowprice/tvoriginalprice
        // tvpeople/btadd0/lladd1/btminus/btmid/btminus
        ImageView ivBack;
        ImageView ivMS;
        RelativeLayout rlSurplusTime;
        TextView tvSurplusTime;
        TextView tvTitle;
        TextView tvNowPrice;
        TextView tvOriginalPrice;
        RelativeLayout rlPeople;
        TextView tvPeople;
        Button btAdd0;
        LinearLayout llAdd1;
        Button btMinus;
        Button btMid;
        Button btAdd;
    }
}

ExpandableList 這里需要3個布局:

1、在activity中的listview

2、child_item

3、group_item


include 外面要包個linearlayout

android:layout_weight="1"

可以控制scrollview的擠壓下層view,導致不顯示


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

宝坻区| 温州市| 扶绥县| 年辖:市辖区| 合水县| 济宁市| 新蔡县| 佳木斯市| 鄂托克旗| 嘉峪关市| 罗山县| 吕梁市| 个旧市| 延寿县| 西吉县| 无为县| 榕江县| 太原市| 修武县| 安西县| 任丘市| 西华县| 新野县| 开封市| 桐乡市| 肇东市| 南通市| 海淀区| 白城市| 广东省| 鱼台县| 随州市| 吉安市| 东丰县| 宽甸| 大同县| 文水县| 礼泉县| 高淳县| 成安县| 航空|