آموزش های این وب سایت به صورت رایگان در دسترس است. اطلاعات بیشتر
بروز خطا
   [message]
اشتراک در سوال
رای ها
[dataList]

تعریف آداپتر تو در تو برای لیست ویو های تو در تو

سپهر  11 سال پیش  11 سال پیش
0 0

من یک لیست ویو به همراه یک آداپتر تعریف کردم که آیتم های این لیست ویو یک لیست ویوی افقی هست 

یعنی توی آداپتر اصلی و توی getview اومدم لیست ویوی بعدیم رو setadapter کردم 

مشکلی که الان دارم اینه که موقع اسکرول کردن یکم لیستم لگ میزنه

میخاستم بدونم چطور میتونم این مشکل رو برطرف کنم ؟

  @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        View view = convertView;
        final StructHorizontalPinList item = getItem(position);
        LayoutInflater inflater = LayoutInflater.from(getContext());
        if (view == null)
        {
            if (item.getType() == StructHorizontalPinList.SECTION)
            {
                view = inflater.inflate(R.layout.list_item_section, null);
            } else
            {
                view = inflater.inflate(R.layout.list_item_horizontal_scroll, null);

            }

        }

        if (item.getType() == StructHorizontalPinList.SECTION)
        {
            view.setBackgroundColor(getContext().getResources().getColor(R.color.actionbar_title_color));
            TextView txtSection = (TextView) view.findViewById(R.id.txtSection);
            txtSection.setText(item.getTitle());
        }
        else if (item.getType() == StructHorizontalPinList.ITEM)
        {

      
            ArrayList<HashMap<String, String>> allContents = new ArrayList<HashMap<String, String>>();
            ArrayList<String> tags = new ArrayList<String>();
            for (int i = 0; i < item.getItems().size(); i++) {
                HashMap<String, String> hashMap = new HashMap<String, String>();
                hashMap.put("title",
                        item.getItems().get(i).getTitle());
                hashMap.put("subtitle",
                        item.getItems().get(i).getSubTitle());
                hashMap.put("icon", item.getItems().get(i).getIcon());
                tags.add(i, item.getItems().get(i).getAction());
                allContents.add(hashMap);

            

                AdapterGeneric adapter = new AdapterGeneric(_activity,
                        getContext(),
                        R.layout.list_item_grid_pin,
                        new int[]{ R.id.txtGridTitle, R.id.txtGridSubTitle },
                        new String[]{ "title", "subtitle" },
                        new int[]{ R.id.imgGridIcon },
                        new String[]{ "icon" },
                        allContents,
                        tags, false);

                
                HListView listview = (HListView) view.findViewById(R.id.hListView);
                listview.setAdapter(adapter);

                listview.setOnItemClickListener(new OnItemClickListener() {

                    @Override
                    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                        Linkparser.addAction(item.getItems().get(position).getAction(), _activity, true);
                    }
                });
            }

        }

        return view;

    }
 برای این سوال پاسخی وجود ندارد.

پاسخگویی و مشاهده پاسخ های این سوال تنها برای اعضای ویژه سایت امکان پذیر است .
چنانچه تمایل دارید به همه بخش ها دسترسی داشته باشید میتوانید از این بخش لایسنس این آموزش را خریداری نمایید .