Example usage for android.widget FrameLayout setLayoutParams

List of usage examples for android.widget FrameLayout setLayoutParams

Introduction

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

Prototype

public void setLayoutParams(ViewGroup.LayoutParams params) 

Source Link

Document

Set the layout parameters associated with this view.

Usage

From source file:tv.ouya.sdk.OuyaUnityPlugin.java

private static void updateSafeArea(float progress) {
    // bring in by %
    float percent = 0.1f;
    float ratio = 1 - (1 - progress) * percent;
    float halfRatio = 1 - (1 - progress) * percent * 0.5f;
    float maxWidth = getDisplayWidth();
    float maxHeight = getDisplayHeight();
    Activity activity = IOuyaActivity.GetActivity();
    FrameLayout content = (FrameLayout) activity.findViewById(android.R.id.content);
    LayoutParams layout = content.getLayoutParams();
    layout.width = (int) (maxWidth * ratio);
    layout.height = (int) (maxHeight * ratio);
    content.setLayoutParams(layout);
    content.setX(maxWidth - maxWidth * halfRatio);
    content.setY(maxHeight - maxHeight * halfRatio);
}

From source file:com.android.example.github.testing.SingleFragmentActivity.java

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FrameLayout content = new FrameLayout(this);
    content.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    content.setId(R.id.container);//from w ww .j  a va  2  s . com
    setContentView(content);
}

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);
    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);//from w w  w  . ja v a  2  s .  c  o  m
    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.codebutler.farebot.activities.FragmentWrapperActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    FrameLayout container = new FrameLayout(this);
    container.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
    container.setId(R.id.content);/* w  ww.  j av a2  s  .  com*/
    setContentView(container);

    if (getFragment() == null) {
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        transaction.add(R.id.content, createFragment(), "fragment");
        transaction.commit();
    }
}

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);

    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);//from www  .  jav a2  s.  c o m
    v.setLayoutParams(params);
    v.setGravity(Gravity.CENTER);
    v.setText("Page " + (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);

    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);/*  w w  w.ja va2 s .  c  o m*/
    v.setLayoutParams(params);
    v.setGravity(Gravity.CENTER);
    v.setText("CARD " + (position + 1));

    fl.addView(v);
    return fl;
}

From source file:com.kangsoo.pharmacy.activity.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);/*from   w  w w .j ava2 s .  c o m*/
    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: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);

    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);/*from  w ww .  ja  v  a  2 s.  c o  m*/
    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);

    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);/* w  w  w.  j  a va2s. c  o m*/
    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.marshalchen.common.demoofui.viewpagerSlidingTab.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);/*from  w  w w . j  a  v  a  2s .c  om*/
    v.setLayoutParams(params);
    v.setGravity(Gravity.CENTER);
    v.setBackgroundResource(R.drawable.view_sliding_tab_background_card);
    v.setText("CARD " + (position + 1));

    fl.addView(v);
    return fl;
}