Example usage for android.widget FrameLayout setId

List of usage examples for android.widget FrameLayout setId

Introduction

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

Prototype

public void setId(@IdRes int id) 

Source Link

Document

Sets the identifier for this view.

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. ja  v  a  2  s  . c o  m
    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);
        }
    });
}

From source file:org.solovyev.android.messenger.BaseListFragment.java

@Nonnull
private View createListView() {
    final Context context = getThemeContext();

    final FrameLayout root = new FrameLayout(context);

    // ------------------------------------------------------------------

    final LinearLayout progressContainer = new LinearLayout(context);
    progressContainer.setId(INTERNAL_PROGRESS_CONTAINER_ID);
    progressContainer.setOrientation(VERTICAL);
    progressContainer.setVisibility(GONE);
    progressContainer.setGravity(CENTER);

    final ProgressBar progress = new ProgressBar(context, null, android.R.attr.progressBarStyleLarge);
    progressContainer.addView(progress, new LayoutParams(WRAP_CONTENT, WRAP_CONTENT));

    root.addView(progressContainer, new LayoutParams(MATCH_PARENT, MATCH_PARENT));

    // ------------------------------------------------------------------

    final FrameLayout listViewContainer = new FrameLayout(context);
    listViewContainer.setId(INTERNAL_LIST_CONTAINER_ID);

    final TextView emptyListCaption = new TextView(context);
    emptyListCaption.setId(INTERNAL_EMPTY_ID);
    emptyListCaption.setGravity(CENTER);
    listViewContainer.addView(emptyListCaption, new LayoutParams(MATCH_PARENT, MATCH_PARENT));

    final ListViewAwareOnRefreshListener topRefreshListener = getTopPullRefreshListener();
    final ListViewAwareOnRefreshListener bottomRefreshListener = getBottomPullRefreshListener();

    final View listView;

    if (topRefreshListener == null && bottomRefreshListener == null) {
        pullToRefreshMode = null;/* w  w  w  .ja  va2  s.  c  om*/
        listView = createListView(context);
    } else {
        listView = createPullToRefreshListView(context, topRefreshListener, bottomRefreshListener);
    }

    listViewContainer.addView(listView, new LayoutParams(MATCH_PARENT, MATCH_PARENT));

    root.addView(listViewContainer, new LayoutParams(MATCH_PARENT, MATCH_PARENT));

    // ------------------------------------------------------------------

    root.setLayoutParams(new LayoutParams(MATCH_PARENT, MATCH_PARENT));

    return root;
}

From source file:com.nadmm.airports.ActivityBase.java

public View createContentView(View view) {
    FrameLayout root = new FrameLayout(this);
    int white = ContextCompat.getColor(this, android.R.color.white);
    root.setBackgroundColor(white);/*from w  w  w.  j av a  2s .c  om*/
    root.setDrawingCacheBackgroundColor(white);
    root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    LinearLayout pframe = new LinearLayout(this);
    pframe.setId(R.id.INTERNAL_PROGRESS_CONTAINER_ID);
    pframe.setGravity(Gravity.CENTER);

    ProgressBar progress = new ProgressBar(this, null, android.R.attr.progressBarStyleLarge);
    pframe.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));
    root.addView(pframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    FrameLayout lframe = new FrameLayout(this);
    lframe.setId(R.id.INTERNAL_FRAGMENT_CONTAINER_ID);
    lframe.setVisibility(View.GONE);

    lframe.addView(view, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    return root;
}

From source file:org.protocoderrunner.apprunner.api.PUI.java

@ProtocoderScript
@APIMethod(description = "Adds a processing view", example = "")
@APIParam(params = { "x", "y", "w", "h", "mode={'p2d', 'p3d'" })
public PApplet addProcessing(int x, int y, int w, int h, String mode) {

    initializeLayout();/*from  w w  w  . jav a  2s. c o m*/

    // Create the main layout. This is where all the items actually go
    FrameLayout fl = new FrameLayout(a.get());
    fl.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    fl.setId(200 + (int) (200 * Math.random()));
    fl.setBackgroundResource(R.color.transparent);

    // Add the view
    addViewAbsolute(fl, x, y, w, h);

    PProcessing p = new PProcessing();

    Bundle bundle = new Bundle();
    bundle.putString("mode", mode);
    p.setArguments(bundle);

    FragmentTransaction ft = appRunnerActivity.get().getSupportFragmentManager().beginTransaction();
    ft.add(fl.getId(), p, String.valueOf(fl.getId()));

    // ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
    // ft.setCustomAnimations(android.R.anim.fade_in,
    // android.R.anim.fade_out);
    ft.addToBackStack(null);
    ft.commit();

    return p;

}