Basit bir liste görünümü ayarladım, ancak sadece beyaz bir ekran gösteriyor. onOptionsItemSelected içindeki ana etkinlikte aşağıdaki koda sahibim.android liste görünümü yerine beyaz bir ekran gösterir
Intent l = new Intent(getApplicationContext(),AboutTest.class);
startActivity(l);
Sorun nedir?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/listView">
</ListView>
</RelativeLayout>
aktivite:
public class AboutTest extends Activity {
String[] list = { "hello1", "hello2", "hello3",
"hello4", "hello5"};
@Override
public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
super.onCreate(savedInstanceState, persistentState);
setContentView(R.layout.about_test);
ListView myList = (ListView)findViewById(R.id.listView);
ArrayAdapter<String> adapter=new ArrayAdapter<String>(getApplicationContext(),
android.R.layout.simple_list_item_1, list);
myList.setAdapter(adapter);
}
}
onay android.R.layout.simple_list_item_1. beyaz olabilir. farklı öğe düzenini deneyin veya liste görünümüne yalnızca ayırıcı ekleyin ve sonucu kontrol edin –
Test ettiğiniz cihazın veya emülatörün API seviyesi nedir? –
bu amaç ne yapıyor? –