searchview与listview的结合使用

  • Post author:
  • Post category:其他


package com.example.searchview2; 
 
import android.os.Bundle; 
import android.app.Activity; 
import android.text.TextUtils; 
import android.view.Menu; 
import android.widget.ArrayAdapter; 
import android.widget.ListView; 
import android.widget.SearchView; 
import android.widget.TextView; 
 
public class MainActivity extends Activity implements SearchView.OnQueryTextListener{ 
    ListView listView; 
    SearchView searchView; 
    String[] names; 
    ArrayAdapter<String> adapter; 
    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState); 
        setContentView(R.layout.activity_main); 
        names=new String[]{"aa","ddf","qw","sd","fd","as","cf","re","fg"}; 
        listView=(ListView) findViewById(R.id.list); 
        searchView=(SearchView) findViewById(R.id.searchView); 
         //Note that the 



版权声明:本文为u010095768原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。