Example usage for android.widget FrameLayout setFocusable

List of usage examples for android.widget FrameLayout setFocusable

Introduction

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

Prototype

public void setFocusable(boolean focusable) 

Source Link

Document

Set whether this view can receive the focus.

Usage

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

@Override
public void onResults(Bundle results) {
    long end2finish = System.currentTimeMillis() - speechEndTime;
    status = STATUS_None;//  w w  w. j a 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);
        }
    });
}