-1
的ListView的
//code of AlertDialog
final AlertDialog.Builder alert = new AlertDialog.Builder(getActivity());
alert.setTitle(R.string.modification);
persoFomulair=new ListView(getActivity());
List<HashMap<Boolean,HashMap<String,String>>>list = prepareList(p);
MyListAdapter2 myListAdapter2 = new MyListAdapter2(getActivity(), R.layout.perso_list, list);
persoFomulair.setAdapter(myListAdapter2);
alert.setView(persoFomulair);
alert.setPositiveButton(R.string.valider, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
//What ever you want to do with the value
getValueOfItem();
ModifierPerso modifierPerso = new ModifierPerso();
modifierPerso.execute(type, String.valueOf(p.getId()), date_embauch, salair_journ);
}
});
alert.setNegativeButton(R.string.annuler, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// what ever you want to do with No option.
}
});
AlertDialog alertDialog=alert.create();
alertDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
alertDialog.show();
//what i think you need to see is the only parts from the array adapter bellow this comment
if(type.equals("Date embauch :")){editText.setText(result);editText.setInputType(InputType.TYPE_DATETIME_VARIATION_DATE);}
else if(type.equals("Salair Journal :")){editText.setText(result);editText.setInputType(InputType.TYPE_CLASS_NUMBER);}
else {editText.setVisibility(View.GONE);textView.setText(type+result);}
在尋找我的問題,我發現,這是因爲在Android清單使用adjustPan的。我在對話框中使用了一個EditTexts列表,這將使我無法編寫代碼來工作。此外,它很長,不會讓鍵盤顯示適合屏幕。
這裏的場景的截圖: dialog
請注意,在代碼中,我只是想讓啓用所選的EditText,而不是其他人的。
不工作,我認爲這個問題是因爲使用在廣告EditTexts的列表視圖IM ialog對不對? –
請發佈您的顯示對話框和ListView的代碼。另外,嘗試在dialog.show()之後設置我提到的設置。 –