我正在尝试向我的列表视图添加一个标题,但只添加了标题......剩余的列表视图仍然是空的......并且知道我做错了什么???
这是我的代码...
public class Settings extends Activity {
String setting[];
ListView lv;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
try {
super.onCreate(savedInstanceState);
setContentView(R.layout.settings);
setting = new String[] { "Reset Password" };
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, setting);
lv = (ListView) findViewById(R.id.Lvsettings);
View header = (View) getLayoutInflater().inflate(R.layout.header,
null);
lv.addHeaderView(header);
lv.setAdapter(adapter);
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1,
int position, long arg3) {
// TODO Auto-generated method stub
startact(position);
}
});
} catch (Exception e) {
Toast.makeText(getApplicationContext(), String.valueOf(e),
Toast.LENGTH_LONG).show();
}
}