嗨,我正在第一次使用對話框工作。 我想創建一個對話框,在列表視圖中的項目被點擊後:在onClick事件後創建對話框
String[] listItems = {"Colour", "Font Size",};
ListView lv = (ListView) findViewById(R.id.settings_list);
lv.setAdapter(new ArrayAdapter<String>
(this, android.R.layout.simple_list_item_1, listItems));
lv.setOnItemClickListener(new OnItemClickListener()
{
public void onItemClick(AdapterView<?> parent, View
view, int position, long id)
{
String[] listItems = {"Colour", "Font Size",};
if(listItems[position].equals("Font Size"))
{
public dialog onCreateDialog(Bundle savedInstanceState)
{
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("Choose Font Size");
}
}
}
});
我會在onCreateDialog(捆綁savedInstanceState) 的Eclipse想要一個錯誤;圍繞Bundle savedInstanceState,但developer.android說不然。 任何提示?
這聽起來很有趣,但我怎麼會在onItemClick中調用它? – mind
onCreateDialog(null);例如? – Blackbelt