Может ли кто-нибудь объяснить android.R.layout.simple_list_item_1 и android.R.layout.simple_list_item_2 в arrayadapter в android.
Я знаю в android.R.layout.simple_list_item_1 и android.R.layout.simple_list_item_2 - это макет, который определяется в самом андроиде.
in android.R.layout.simple_list_item_1 содержит только одно текстовое представление, но android.R.layout.simple_list_item_2 содержит два текстовых представления.
Я хочу пример для android.R.layout.simple_list_item_2... как показать два текстовых вида в списке с адаптером.
мой код
package com.app.listview;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class ExampleListViewActivity extends Activity {
private String[] nameArr = new String[]{"Arun","Anil","Ankit","Manoj"};
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ListView listView = (ListView)findViewById(R.id.lv);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1,
android.R.id.text1,
nameArr);
listView.setAdapter(adapter);
}
}