2013-12-10 91 views
1

我有一個FragmentActivity其佈局包含兩個線性佈局。上點擊事件由用戶 鍵盤不顯示編輯文本

  • 第二線性佈局進行

    1. 第一線性佈局的變化是整個應用恆定

    當用戶執行一些點擊操作,我加入該片段到第一佈局

    FragmentTransaction ft = getFragmentManager().beginTransaction(); 
    ft.replace(R.id.llFragmentContainer, FragmentClassObject, "fragment_detail"); 
    

    然後在片段的onCreateView方法中。我誇大了我想展示給用戶的觀點。

    View rootView = inflater.inflate(R.layout.personal_stuff, container, 
           false); 
    

    現在personal_stuff佈局有一些編輯文本字段。

    問題:

    在第一個線性佈局充滿了片段後。當personal_stuff佈局中的EditText被聚焦/點擊時,鍵盤不會顯示給用戶。

    可能是什麼問題?有什麼建議麼 ??

  • +0

    甚至在錄音EDITTEXT小部件它不是把鍵盤? – Techfist

    +1

    http://stackoverflow.com/questions/17149800/keyboard-not-shown-on-inflated-edittext-even-after-clicking-on-it – Riser

    +0

    @Techfist nope。我嘗試點擊編輯文本,但鍵盤沒有顯示:( –

    回答

    0
    public static void forceFocusOnView(final View view) { 
        if (view == null) 
         return; 
        view.post(new Runnable() { 
         @Override 
         public void run() { 
          view.clearFocus(); 
          view.post(new Runnable() { 
           @Override 
           public void run() { 
            view.requestFocus(); 
           } 
          }); 
         } 
        }); 
    } 
    

    forceFocusOnView(myView); 
    

    編輯:公共拼寫不正確被校正爲使得

    相關問題