انجمن سایت کلیدستان


رتبه موضوع:
  • 0 رای - 0 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
لیست ویو سفارشی

لیست ویو سفارشی

#1
سلام بر اساتید
یه لیست ویوی سفارشی در ست کردم حالا می خوام متد getfilter() رو توش overwrite کنم
ممنون میشم کمک کنید

کد:
public class CustomList extends ArrayAdapter<String> implements Filterable {


   private final Activity context;

   //معرفی نام و تصاویر از اکتیوتی
   private final String[] web;
   private final Integer[] imageId;


   public CustomList(Activity context,
                     String[] web, Integer[] imageId) {
       super(context, R.layout.list_file, web);
       this.context = context;
       this.web = web;
       this.imageId = imageId;
   }
   @Override
   public View getView(int position, View view, ViewGroup parent) {
       LayoutInflater inflater = context.getLayoutInflater();
       View rowView= inflater.inflate(R.layout.list_file, null, true);
       TextView txtTitle = (TextView) rowView.findViewById(R.id.textt);
       ImageView imageView = (ImageView) rowView.findViewById(R.id.image);
       txtTitle.setText(web[position]);
       imageView.setImageResource(imageId[position]);
       return rowView;
   }




   @Override
   public Filter getFilter() {
       return new Filter() {
           /* (non-Javadoc)
            * @see android.widget.Filter#performFiltering(java.lang.CharSequence)
            */
           @Override
           protected FilterResults performFiltering(CharSequence constraint) {
               // TODO Auto-generated method stub
               FilterResults results=new FilterResults();



           /*
            * Here, you take the constraint and let it run against the array
            * You return the result in the object of FilterResults in a form
            * you can read later in publichResults.
            */
               return null;
           }

           /* (non-Javadoc)
            * @see android.widget.Filter#publishResults(java.lang.CharSequence, android.widget.Filter.FilterResults)
            */
           @Override
           protected void publishResults(CharSequence constraint, FilterResults results) {
               // TODO Auto-generated method stub
           /*
            * Here, you take the result, put it into Adapters array
            * and inform about the the change in data.
            */
           }

       };
   }

}
پاسخ
 سپاس شده توسط شماره مجازی امارات ، تلگرام ضد فیلتر 2023


پرش به انجمن:


کاربران در حال بازدید این موضوع: 1 مهمان