コード例 #1
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState, R.layout.drop_down_listview_demo);

    listView = (DropDownListView) findViewById(R.id.list_view);
    // set drop down listener
    listView.setOnDropDownListener(
        new OnDropDownListener() {

          @Override
          public void onDropDown() {
            new GetDataTask(true).execute();
          }
        });

    // set on bottom listener
    listView.setOnBottomListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            new GetDataTask(false).execute();
          }
        });

    listItems = new LinkedList<String>();
    listItems.addAll(Arrays.asList(mStrings));
    adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, listItems);
    listView.setAdapter(adapter);
  }