Example usage for android.widget FrameLayout FrameLayout

List of usage examples for android.widget FrameLayout FrameLayout

Introduction

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

Prototype

public FrameLayout(@NonNull Context context) 

Source Link

Usage

From source file:com.j1024.mcommon.support.GenericFragmentActivity.java

@Override
protected void onCreate(Bundle bundle) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(bundle);
    FrameLayout layout = new FrameLayout(this.getApplicationContext());
    setContentView(layout, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    Bundle args = getIntent().getExtras();
    String fragmentClassName = args.getString(KEY_FRAGMENT_CLASS);

    try {/* w w w  . j a  va 2 s .c o  m*/
        Fragment fragment = (Fragment) Class.forName(fragmentClassName).newInstance();
        Bundle argument = args.getBundle(KEY_FRAGMENT_ARGS);
        fragment.setArguments(argument);

        attachFragment(getSupportFragmentManager(), fragment);
    } catch (Exception e) {
        throw new IllegalStateException("Has error in new instance of fragment");
    }
}

From source file:com.xwj.toolbardemo.BaseCardFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

    FrameLayout fl = new FrameLayout(getActivity());
    fl.setLayoutParams(params);//ww w  .  j a v a2  s.co  m
    fl.setBackgroundResource(drawables[position]);
    final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8,
            getResources().getDisplayMetrics());

    TextView v = new TextView(getActivity());
    params.setMargins(margin, margin, margin, margin);
    v.setLayoutParams(params);
    v.setLayoutParams(params);
    v.setGravity(Gravity.BOTTOM);
    v.setText("fragment " + (position + 1));

    fl.addView(v);
    return fl;
}

From source file:com.collcloud.frame.viewpager.main.Fragment1.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

    FrameLayout fl = new FrameLayout(getActivity());
    fl.setLayoutParams(params);/*  w  w  w  .ja  v  a 2 s.  c om*/

    final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8,
            getResources().getDisplayMetrics());

    TextView v = new TextView(getActivity());
    params.setMargins(margin, margin, margin, margin);
    v.setLayoutParams(params);
    v.setLayoutParams(params);
    v.setGravity(Gravity.CENTER);
    v.setBackgroundResource(R.drawable.tab_pagertab_background_card);
    v.setText("fragment1 CARD is " + (position + 1));

    fl.addView(v);
    return fl;
}

From source file:com.collcloud.frame.viewpager.main.Fragment2.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

    FrameLayout fl = new FrameLayout(getActivity());
    fl.setLayoutParams(params);//w w w .  ja  va 2  s  .co m

    final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8,
            getResources().getDisplayMetrics());

    TextView v = new TextView(getActivity());
    params.setMargins(margin, margin, margin, margin);
    v.setLayoutParams(params);
    v.setLayoutParams(params);
    v.setGravity(Gravity.CENTER);
    v.setBackgroundResource(R.drawable.tab_pagertab_background_card);
    v.setText("fragment2 CARD is " + (position + 1));

    fl.addView(v);
    return fl;
}

From source file:android.arch.lifecycle.testapp.CollectingSupportFragment.java

@Nullable
@Override/* w  w  w . j  a v a 2  s.c o m*/
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    //noinspection ConstantConditions
    FrameLayout layout = new FrameLayout(container.getContext());
    layout.setId(R.id.child_fragment_container);
    return layout;
}

From source file:com.aaagame.proframework.fragment.T_PaletteFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

    FrameLayout fl = new FrameLayout(getActivity());
    fl.setLayoutParams(params);/*  www  . j  a  v a 2 s  .  c  om*/
    fl.setBackgroundResource(drawables[position]);
    final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8,
            getResources().getDisplayMetrics());

    TextView v = new TextView(getActivity());
    params.setMargins(margin, margin, margin, margin);
    v.setLayoutParams(params);
    v.setLayoutParams(params);
    v.setGravity(Gravity.BOTTOM);
    v.setText("CARD " + (position + 1));

    fl.addView(v);
    return fl;
}

From source file:org.ganjp.jone.common.WhiteCardFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

    FrameLayout fl = new FrameLayout(getActivity());
    fl.setLayoutParams(params);/*from  w w  w . j av a 2 s .  co m*/

    final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8,
            getResources().getDisplayMetrics());

    TextView v = new TextView(getActivity());
    params.setMargins(margin, margin, margin, margin);
    v.setLayoutParams(params);
    v.setLayoutParams(params);
    v.setGravity(Gravity.CENTER);
    v.setBackgroundResource(R.drawable.background_card);
    v.setText("No Record " + (position + 1));

    fl.addView(v);
    return fl;
}

From source file:co.nextix.jardine.SuperAwesomeCardFragment.java

@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {

    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

    fl = new FrameLayout(getActivity());
    fl.setLayoutParams(params);/*  w  ww  .  j av  a2 s .c  om*/
    fl.setId(0123);

    //      FragmentTransaction ft = getFragmentManager().beginTransaction();
    //      
    //      EditActivityInfoFragment.instantiate(getActivity(), EditActivityInfoFragment.class.getName());
    //      AddActivityWithCoSMRsFragment.instantiate(getActivity(), AddActivityWithCoSMRsFragment.class.getName());
    //
    //      if (position == 0) {
    //         Log.e("0", "here");
    //         ft.replace(fl.getId(), new EditActivityInfoFragment());
    //         ft.addToBackStack(null);
    //         ft.commit();
    //      } else if (position == 1) {
    //         Log.e("1", "here");
    //         ft.replace(fl.getId(), new AddActivityWithCoSMRsFragment());
    //         ft.addToBackStack(null);
    //         ft.commit();
    //      }

    return fl;
}

From source file:com.eric.quora.fragment.SuperAwesomeCardFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

    FrameLayout fl = new FrameLayout(getActivity());
    fl.setLayoutParams(params);//from  w ww  .  j  ava2 s. c o  m
    fl.setBackgroundResource(mipmaps[position]);
    final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8,
            getResources().getDisplayMetrics());

    TextView v = new TextView(getActivity());
    params.setMargins(margin, margin, margin, margin);
    v.setLayoutParams(params);
    v.setLayoutParams(params);
    v.setGravity(Gravity.BOTTOM);
    v.setText("CARD " + (position + 1));

    fl.addView(v);
    return fl;
}

From source file:com.ijiaban.tabslide.SuperAwesomeCardFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    FrameLayout fl = new FrameLayout(getActivity());
    TuiJFragment TJ = new TuiJFragment();
    fl.setLayoutParams(params);/*w w w  .  j  a  v a  2  s .c om*/

    final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8,
            getResources().getDisplayMetrics());

    TextView v = new TextView(getActivity());
    params.setMargins(margin, margin, margin, margin);
    v.setLayoutParams(params);
    v.setLayoutParams(params);
    v.setGravity(Gravity.CENTER);
    v.setBackgroundResource(R.drawable.background_card);
    v.setText("CARD " + (position + 1));
    getChildFragmentManager().beginTransaction().add(TJ, ARG_POSITION);
    fl.addView(v);
    return fl;
}