Hem ListView hem de mesaj ile diyalog oluşturmam gerekiyor, ancak http://code.google.com/p/android/issues/detail?id=10948 standardına göre standart AlertDialog ile mümkün değil. Bu yüzden, metin ve liste görünümü ile özel görünüm oluşturmaya ve iletişim kutusuna eklemeye karar verdim. Bununla birlikte, liste görünümüm boş olarak çizilmiştir. AyrıcaListe görünümü ve mesaj ile iletişim kutusu
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Hello, title!");
LayoutInflater factory = LayoutInflater.from(this);
View content = factory.inflate(R.layout.dialog, null);
ListView lv = (ListView) content.findViewById(R.id.list);
lv.setAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_single_choice, ITEMS));
lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
builder.setView(content).setPositiveButton("OK", this).setNegativeButton("Cancel", this);
AlertDialog alert = builder.create();
alert.show();
Ben: Herhangi bir yardım büyük takdir
:
İşte<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hello, text!" />
<ListView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/list"
></ListView>
</LinearLayout>
sonucudur: Burada
final String[] ITEMS = new String[] { "a", "b", "c" };
ve iletişim düzeni İşte java kodu . Teşekkürler!