package xushuai.viewpager_indicator_demo; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; //仿微信 public class UnderlinesSamples extends FragmentActivity implements AdapterView.OnItemClickListener{ private ListView mSampleLv; private String[] adapterData = new String[] { "UnderlinesDefault", "UnderlinesNoFade" }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mSampleLv = (ListView) findViewById(R.id.lv_sample); mSampleLv.setAdapter(new ArrayAdapter<String>(UnderlinesSamples.this, android.R.layout.simple_list_item_1, adapterData)); mSampleLv.setOnItemClickListener(this); } @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { switch (position){ case 0: redictTo(UnderlinesDefault.class); break; case 1: redictTo(UnderlinesNoFade.class); break; } } private void redictTo(Class clazz){ Intent intent = new Intent(this,clazz); startActivity(intent); } }