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


رتبه موضوع:
  • 0 رای - 0 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
یک لیست +(سورس هستش)+ (لیست ویو و انیمشن و جستجو در یک اکتیویتی همزمان)

یک لیست +(سورس هستش)+ (لیست ویو و انیمشن و جستجو در یک اکتیویتی همزمان)

#3
این لینک و ببینید حجم فایل 2.5 مگه آپ نشد

https://drive.google.com/file/d/0B79SNhN...I0dlk/view

تنظیمات اشتراک و اشکال داشت.
کد های لازم و اینجا میزارم

  bar.class
کد پی‌اچ‌پی:
public class Bar extends Activity {
    
EditText edittext;
    
ListView listview;
    
String text;;
    
int textlength 0;
    
ArrayList<Stringtext_sort = new ArrayList<String>;();
    
SharedPreferences full;

    public 
void onCreate(Bundle savedInstanceState) {

        
super.onCreate(savedInstanceState);
        
screnpref();
        
setContentView(R.layout.activity_bar);

        
text = new String[23];
        for (
int x 123 11) {
            
String this_subject "subject_" String.valueOf(x);
            
int resID getResources().getIdentifier(this_subject"string",
                    
getPackageName());
            
text[1] = getResources().getString(resID);
        }

        
edittext = (EditTextfindViewById(R.id.EditText01);
        
listview = (ListViewfindViewById(R.id.ListView01);
        
listview.setAdapter(new MyCustomAdapter(textnull));
        
edittext.addTextChangedListener(new TextWatcher() {

            public 
void afterTextChanged(Editable s) {

            }

            public 
void beforeTextChanged(CharSequence sint startint count,
                    
int after) {

            }

            public 
void onTextChanged(CharSequence sint startint before,
                    
int count) {

                
textlength edittext.getText().length();
                
text_sort.clear();

                for (
int i 0text.lengthi++) {
                    if (
textlength <= text[i].length()) {
                        if (
edittext
                                
.getText()
                                .
toString()
                                .
equalsIgnoreCase(
                                        (String) 
text[i].subSequence(0,
                                                
textlength))) {
                            
text_sort.add(text[i]);

                        }
                    }
                }

                
listview.setAdapter(new MyCustomAdapter(text_sortnull));

            }
        });
        
listview.setOnItemClickListener(new OnItemClickListener() {

            @
Override
            
public void onItemClick(AdapterView<?> parent, View view,
                    int position, long id) {
                int orgPos = 0;
                if (text.length != text_sort.size()) {
                    // The list on which we clicked is sorted!
                    String clickedText = text_sort.get(position);
                    int i1 = 0;
                    boolean found = false;

                    while (i1 < text.length && found == false) {
                        if (clickedText == text[i1]) {
                            orgPos = i1;
                            found = true;
                        } else {
                            i1++;
                        }
                    }
                    Intent i2 = new Intent(getApplicationContext(),
                            Secendbardari1.class);
                    String Subject_number = String.valueOf(orgPos + 1);
                    i2.putExtra("subject_number", Subject_number);
                    startActivity(i2);

                } else {
                    Intent i = new Intent(getApplicationContext(),
                            Secendbardari1.class);
                    String Subject_number = String.valueOf(position + 1);
                    i.putExtra("subject_number", Subject_number);
                    startActivity(i);

                }

            }
        });
        edittext.setText("search");
        edittext.setText("");
    }

    class MyCustomAdapter extends BaseAdapter {

        String data_text;

        MyCustomAdapter() {

        }

        MyCustomAdapter(String text, int image) {
            data_text = text;

        }

        MyCustomAdapter(ArrayList<String> text, ArrayList<Integer> image) {
            data_text = new String[text.size()];

            for (int i = 0; i < text.size(); i++) {
                data_text[i] = text.get(i);

            }

        }

        public int getCount() {
            return data_text.length;
        }

        public String getItem(int position) {
            return null;
        }

        public long getItemId(int position) {
            return position;
        }

        public View getView(int position, View convertView, ViewGroup parent) {

            LayoutInflater inflater = getLayoutInflater();
            View row;

            row = inflater.inflate(R.layout.list_item, parent, false);

            TextView textview = (TextView) row.findViewById(R.id.lblListItem);

            textview.setText(data_text[position]);
            Animation animation = AnimationUtils.loadAnimation(
                    getApplicationContext(), R.anim.slide_in_right);
            row.startAnimation(animation);
            return (row);

        }
    }
}[/i][/i][/i][/i] 


[i][i][i]اینم layout  activity_bar[/i][/i][/i]
کد پی‌اچ‌پی:
[i][i][i][i]<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#ffffff"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:textAppearance="?android:attr/textAppearanceSmall" />

    <EditText
        android:id="@+id/EditText01"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:drawableLeft="@android:drawable/ic_menu_search"
        android:ems="10"
        android:gravity="right"
        android:hint="جستجو..." >

    </EditText>

    <ListView
        android:id="@+id/ListView01"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="#FF9966"
        android:dividerHeight="10dp"
        android:padding="5dp"
        android:paddingBottom="5dp"
        android:paddingLeft="5dp"
        android:paddingRight="5dp"
        android:paddingTop="5dp" >
    </ListView>

</LinearLayout>[/i][/i][/i][/i] 
[i][i][i]این هم layout آیتم ها  list_item.xml[/i][/i][/i]
کد پی‌اچ‌پی:
[i][i][i][i]<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/lblListItem"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_gravity="fill_horizontal"
        android:layout_margin="5dp"
        android:layout_marginBottom="5dp"
        android:layout_marginTop="5dp"
        android:gravity="center"
        android:paddingBottom="5dp"
        android:paddingLeft="?android:attr/expandableListPreferredChildPaddingLeft"
        android:paddingTop="5dp"
        android:textColor="#000000"
        android:textSize="14sp" />

</LinearLayout>[/i][/i][/i][/i] 

Source Code توسط مدیر سایت، پیوست همین ارسال شد.


فایل‌های پیوست

دانلود listsearchanim1.zip

نام فایل listsearchanim1.zip
نوع فایل .zip
دفعات دانلود 493
اندازه 2.33 MB
ارسال کننده فایل saeed.f436
پاسخ
 سپاس شده توسط admin


پیام‌های این موضوع
RE: یک لیست +(سورس هستش)+ - توسط admin - ۱۳۹۴/۰۵/۰۳, ۱۱:۲۰ ب.ظ
RE: یک لیست +(سورس هستش)+ (لیست ویو و انیمشن و جستجو در یک اکتیویتی همزمان) - توسط saeed.f436 - ۱۳۹۴/۰۵/۰۴, ۱۱:۵۸ ق.ظ

پرش به انجمن:


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