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:fragment.MusicFragment.java

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

    FrameLayout fl = new FrameLayout(getActivity());
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    fl.setLayoutParams(params);/*from w  ww  .  ja va 2s .c o  m*/

    switch (position) {
    case 0:
        View recorderView = inflater.inflate(R.layout.tab_recorder, null);
        fl.addView(recorderView);
        Fragment recorderFragment = new RecorderFragment();
        getFragmentManager().beginTransaction().replace(R.id.tab_recorder, recorderFragment).commit();
        break;
    case 1:
        View drumView = inflater.inflate(R.layout.tab_drum, null);
        fl.addView(drumView);
        Fragment drumFragment = new DrumFragment();
        getFragmentManager().beginTransaction().replace(R.id.tab_drum, drumFragment).commit();
        break;
    case 2:
        View saxophoneView = inflater.inflate(R.layout.tab_saxophone, null);
        fl.addView(saxophoneView);
        Fragment saxophoneFragment = new SaxophoneFragment();
        getFragmentManager().beginTransaction().replace(R.id.tab_saxophone, saxophoneFragment).commit();
        break;
    case 3:
        View handBellView = inflater.inflate(R.layout.tab_handbell, null);
        fl.addView(handBellView);
        Fragment handBellFragment = new HandBellFragment();
        getFragmentManager().beginTransaction().replace(R.id.tab_handbell, handBellFragment).commit();
        break;
    case 4:
        View harpView = inflater.inflate(R.layout.tab_harp, null);
        fl.addView(harpView);
        Fragment harpFragment = new HarpFragment();
        getFragmentManager().beginTransaction().replace(R.id.tab_harp, harpFragment).commit();
        break;
    }
    return fl;
}

From source file:com.jia.blossom.viewpageindicator.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  www. j av  a  2 s.c o  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("CARD " + (position + 1));
    fl.addView(v);
    return fl;
}

From source file:io.givenow.app.fragments.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  w  w. j  a  va  2s . 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("CARD " + (position + 1));

    fl.addView(v);
    return fl;
}

From source file:com.example.mac.myapplication.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 w  w .  ja  v a2 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.setText("CARD " + (position + 1));

    fl.addView(v);
    return fl;
}

From source file:com.example.fazazi.muslimprayer.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 a va  2s .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.setText("Page " + (position + 1));

    fl.addView(v);
    return fl;
}

From source file:cn.yunt.www.pagerslidingtabstrip.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);// w w  w  .  j a va  2 s .  c om

    final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 0,
            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));

    fl.addView(v);
    return fl;
}

From source file:com.ageelg.android.testviewpagerwslider.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);

    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);//  w  w  w  . j  a  v a2s .  c o m
    v.setBackgroundResource(R.drawable.background_card);
    v.setText("CARD " + (position + 1));

    fl.addView(v);
    return fl;
}

From source file:com.flexible.viewholders.ContentViewHolder.java

/**
 * @param view         The {@link View} being hosted in this ViewHolder
 * @param adapter      Adapter instance of type {@link FlexibleAdapter}
 * @param stickyHeader true if the ViewHolder is a header to be sticky
 * @since 5.0.0-b7/*from  w  ww  . j  av a 2 s .  com*/
 */
ContentViewHolder(View view, FlexibleAdapter adapter, boolean stickyHeader) {
    // Since itemView is declared "final", the split is done before the View is initialized
    super(stickyHeader ? new FrameLayout(view.getContext()) : view);

    if (stickyHeader) {
        itemView.setLayoutParams(
                adapter.getRecyclerView().getLayoutManager().generateLayoutParams(view.getLayoutParams()));
        ((FrameLayout) itemView).addView(view); //Add View after setLayoutParams
        float elevation = ViewCompat.getElevation(view);
        if (elevation > 0) {
            ViewCompat.setBackground(itemView, view.getBackground());
            ViewCompat.setElevation(itemView, elevation);
        }
        contentView = view;
    }
}

From source file:com.codewarrior.mobiocontact.fragments.DialerFragment.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 .  j av  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 44");

    fl.addView(v);
    return fl;
}

From source file:com.codewarrior.mobiocontact.fragments.RecentFragment.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  .  ja v a2s . c o  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("CARD 22");

    fl.addView(v);
    return fl;
}