Example usage for android.widget FrameLayout setFocusableInTouchMode

List of usage examples for android.widget FrameLayout setFocusableInTouchMode

Introduction

In this page you can find the example usage for android.widget FrameLayout setFocusableInTouchMode.

Prototype

public void setFocusableInTouchMode(boolean focusableInTouchMode) 

Source Link

Document

Set whether this view can receive focus while in touch mode.

Usage

From source file:cn.jasonlv.siri.activity.MainActivity.java

@Override
public void onResults(Bundle results) {
    long end2finish = System.currentTimeMillis() - speechEndTime;
    status = STATUS_None;/*from w  w  w.  ja v  a 2  s.c  om*/
    ArrayList<String> nbest = results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
    print("?" + Arrays.toString(nbest.toArray(new String[nbest.size()])));
    String json_res = results.getString("origin_result");
    Log.e(LOG_TAG, json_res);

    View inputPanel = getLayoutInflater().inflate(R.layout.input_layout, null);
    TextView inputTextView = (TextView) inputPanel.findViewById(R.id.input_text);
    inputTextView.setText(nbest.get(0));
    inputPanel.setFocusable(true);
    inputPanel.setFocusableInTouchMode(true);
    container.addView(inputPanel);

    //View fragmentContainer = getLayoutInflater().inflate(R.layout.fragment_container_layout, null);
    //container.addView(fragmentContainer);

    FrameLayout fragmentContainer = new FrameLayout(this);
    fragmentContainer.setId(fragmentConatainerId);
    fragmentContainer.setFocusable(true);
    fragmentContainer.setFocusableInTouchMode(true);

    container.addView(fragmentContainer);
    onProcessingResult(nbest, json_res, fragmentConatainerId);
    fragmentConatainerId++;

    scrollView.post(new Runnable() {
        @Override
        public void run() {
            scrollView.fullScroll(View.FOCUS_DOWN);
        }
    });
}