Example usage for android.view View setLayoutParams

List of usage examples for android.view View setLayoutParams

Introduction

In this page you can find the example usage for android.view View setLayoutParams.

Prototype

public void setLayoutParams(ViewGroup.LayoutParams params) 

Source Link

Document

Set the layout parameters associated with this view.

Usage

From source file:com.near.chimerarevo.fragments.ProductFragment.java

private void addTitle(String text) {
    TextView title = new TextView(getActivity());
    title.setBackgroundColor(getResources().getColor(R.color.prod_title_color));
    title.setTextColor(getResources().getColor(android.R.color.white));
    title.setTypeface(Typeface.createFromAsset(getActivity().getAssets(), "roboto_light.ttf"));
    title.setTextSize(22);/* w  w w . j av a  2s  . c o  m*/
    title.setPadding(15, 10, 15, 10);

    LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    title.setLayoutParams(params);

    title.setText(text);

    View div = new View(getActivity());
    div.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, 2));
    div.setBackgroundColor(getResources().getColor(R.color.prod_title_color));

    lay.addView(title);
    lay.addView(div);
}

From source file:br.liveo.ndrawer.FragmentMain.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // TODO Auto-generated method stub      
    View rootView = inflater.inflate(R.layout.fragment_main, container, false);

    TextView mTxtTitle = (TextView) rootView.findViewById(R.id.txtTitle);
    mTxtTitle.setText(getArguments().getString(TEXT_FRAGMENT));

    rootView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    return rootView;
}

From source file:com.igs.qhrzlc.utils.view.astuetz.viewpager.extensions.FixedTabsView.java

/**
 * Initialize and add all tabs to the layout
 *///w  w  w. j a va2s .  c om
private void initTabs() {

    removeAllViews();
    mTabs.clear();

    if (mAdapter == null)
        return;

    for (int i = 0; i < mPager.getAdapter().getCount(); i++) {

        final int index = i;

        View tab = mAdapter.getView(i);
        LayoutParams params = new LayoutParams(0, LayoutParams.WRAP_CONTENT, 1.0f);
        tab.setLayoutParams(params);
        this.addView(tab);

        mTabs.add(tab);

        if (i != mPager.getAdapter().getCount() - 1) {
            this.addView(getSeparator());
        }

        tab.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                mPager.setCurrentItem(index);
            }
        });

    }

    selectTab(mPager.getCurrentItem());
}

From source file:com.example.onepointnews.fragment.SlidLeftFragment.java

void initParams(View view) {
    float scale = this.getResources().getDisplayMetrics().density;
    DisplayMetrics dm = new DisplayMetrics();
    this.getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
    view.setLayoutParams(new LayoutParams(dm.widthPixels - (int) (80 * scale + 0.5f), dm.heightPixels));
}

From source file:br.liveo.ndrawer.ui.fragment.MainFragment41.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // TODO Auto-generated method stub      
    View rootView = inflater.inflate(R.layout.fragment_main41, container, false);

    TextView mTxtTitle = (TextView) rootView.findViewById(R.id.txtTitle41);
    mTxtTitle.setText(getArguments().getString(TEXT_FRAGMENT));

    rootView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    return rootView;
}

From source file:com.canyinghao.canrefresh.classic.RotateRefreshView.java

public RotateRefreshView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    mRotateAnimation = new RotateAnimation(0, 720, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
            0.5f);/*from  w w  w  . j a  v  a 2 s  .  co m*/
    rotateHight = (int) getResources().getDimension(R.dimen.refresh_height_rotate);

    View v = LayoutInflater.from(context).inflate(R.layout.layout_rotate_refresh, null);

    addView(v);

    FrameLayout.LayoutParams params = (LayoutParams) v.getLayoutParams();
    params.height = rotateHight;
    v.setLayoutParams(params);

}

From source file:br.liveo.ndrawer.ui.fragment.MainFragment42.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // TODO Auto-generated method stub      
    View rootView = inflater.inflate(R.layout.fragment_main42, container, false);

    TextView mTxtTitle = (TextView) rootView.findViewById(R.id.txtTitle42);
    mTxtTitle.setText(getArguments().getString(TEXT_FRAGMENT));

    rootView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    return rootView;
}

From source file:com.nkana.app.fragment.RemindersFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // TODO Auto-generated method stub      
    View rootView = inflater.inflate(R.layout.fragment_reminders, container, false);

    TextView mTxtTitle = (TextView) rootView.findViewById(R.id.txtTitle);
    mTxtTitle.setText(getArguments().getString(TEXT_FRAGMENT));

    rootView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    return rootView;
}

From source file:com.nkana.app.fragment.LocationSharingFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // TODO Auto-generated method stub      
    View rootView = inflater.inflate(R.layout.fragment_locationshare, container, false);

    TextView mTxtTitle = (TextView) rootView.findViewById(R.id.txtTitle);
    mTxtTitle.setText(getArguments().getString(TEXT_FRAGMENT));

    rootView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    return rootView;
}

From source file:com.nkana.app.fragment.AboutFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // TODO Auto-generated method stub      
    View rootView = inflater.inflate(R.layout.fragment_help, container, false);

    mTxtTitle = (TextView) rootView.findViewById(R.id.txtTitle);
    //        mTxtTitle.setText(getArguments().getString(TEXT_FRAGMENT));

    rootView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    return rootView;
}