我將解釋我在alertBox中完成的操作i爲alertBox充氣視圖,其名稱爲view。在那個視圖中,LinearLayout的名字是'main layout',我膨脹了包含radioGroups和editTexts的另一個視圖。它的名字是佈局。我將第二個視圖(佈局)添加到第一個視圖(視圖)。當我點擊收音機按鈕正常工作。但是當我點擊編輯文本它不會打開softkeyboard -無法打開editText上的鍵盤
我打開一個警告框,充氣視圖。但是當我點擊alertBox中的EditText時,它不顯示軟鍵盤。
Builder alertCreate = new AlertDialog.Builder(parent);
alertCreate.setTitle("New Schedule");
inflater = LayoutInflater.from(parent);
View view = inflater.inflate(R.layout.activity_schedule, null);
spinnerRepeat = (Spinner)view.findViewById(R.id.spinner_schedule_repeat);
spinnerRepeat.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
LinearLayout mainLayout= (LinearLayout)view.findViewById(R.id.main_Layout);
LinearLayout spinnerLayout = (LinearLayout)view.findViewById(R.id.spinner_Layout);
View weeklyLayout = inflater.inflate(R.layout.schedule_week_selection, null);
initializeWeeks(weeklyLayout);
if(arg2>0)
{
if(flag==0)
{
View layout = inflater.inflate(R.layout.schedule_ends_on, null);
RelativeLayout layout2 =(RelativeLayout)layout.findViewById(R.id.endsOn_layout);
rgEndsOn =(RadioGroup)layout.findViewById(R.id.radioGroup_endsOn);
radio_occr=(RadioButton)layout.findViewById(R.id.radio_schedule_occr);
radio_date=(RadioButton)layout.findViewById(R.id.radio_schedule_date);
occurence=(TextView)layout.findViewById(R.id.tv_schedule_Occur);
addCheckListenerToRgEndsOn();
etEndsOn=(EditText)layout.findViewById(R.id.Et_schedule_occur);
etEndDate=(EditText)layout.findViewById(R.id.et_schedule_enddate);
etEndDate.setClickable(true);
etEndDate.setText(formatDate(TimeFormater.DateToString(startDate)));
mainLayout.addView(layout, 3);
flag=1;
}
if(arg2==2)
{
spinnerLayout.addView(weeklyLayout,2);
}
else
{
View v = (View)spinnerLayout.getChildAt(2);
spinnerLayout.removeView(v);
}
}
else
{
Log.e("id",""+mainLayout.getChildAt(3));
View v = (View)mainLayout.getChildAt(3);
View v2 = (View)spinnerLayout.getChildAt(2);
spinnerLayout.removeView(v2);
mainLayout.removeView(v);
flag=0;
}
}
但是當我點擊的EditText(etEndsOn)它不會彈出鍵盤
粘貼您的清單 – Aamirkhan 2013-04-24 09:31:44