content: package cn.like.sample;
  
  import android.os.Bundle;
  import android.support.design.widget.FloatingActionButton;
  import android.support.design.widget.Snackbar;
  import android.support.v7.app.AppCompatActivity;
  import android.support.v7.widget.Toolbar;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.BaseAdapter;
  import android.widget.ListView;
  import android.widget.TextView;
  
  import java.util.ArrayList;
  import java.util.List;
  
  public class Main2Activity extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main2);
          Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
  
          FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
          fab.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                          .setAction("Action", null).show();
              }
          });
  
          ListView listView = (ListView) findViewById(R.id.list_view);
          listView.setAdapter(new SimpleAdapter());
      }
  
      class SimpleAdapter extends BaseAdapter {
          List<String> strings = new ArrayList<>();
  
          public SimpleAdapter() {
              strings.add("鹅鹅鹅");
              strings.add("曲项向天歌");
              strings.add("白毛浮绿水");
              strings.add("红掌拨清波");
          }
  
          @Override
          public int getCount() {
              return strings.size();
          }
  
          @Override
          public Object getItem(int position) {
              return strings.get(position);
          }
  
          @Override
          public long getItemId(int position) {
              return position;
          }
  
          @Override
          public View getView(int position, View convertView, ViewGroup parent) {
              if (convertView == null) {
                  convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_layout, null);
              }
              ((TextView)convertView).setText((CharSequence) getItem(position));
              return convertView;
          }
      }
  }
  