Search in sources :

Example 36 with LayoutParams

use of android.widget.FrameLayout.LayoutParams in project UltimateAndroid by cymcsg.

the class SuperAwesomeCardFragment method onCreateView.

@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);
    v.setBackgroundResource(R.drawable.view_sliding_tab_background_card);
    v.setText("CARD " + (position + 1));
    fl.addView(v);
    return fl;
}
Also used : LayoutParams(android.widget.FrameLayout.LayoutParams) FrameLayout(android.widget.FrameLayout) TextView(android.widget.TextView)

Aggregations

LayoutParams (android.widget.FrameLayout.LayoutParams)36 View (android.view.View)19 FrameLayout (android.widget.FrameLayout)10 Intent (android.content.Intent)5 Rect (android.graphics.Rect)5 TextView (android.widget.TextView)5 SystemServicesProxy (com.android.systemui.recents.misc.SystemServicesProxy)5 RecentsPackageMonitor (com.android.systemui.recents.model.RecentsPackageMonitor)5 TypedArray (android.content.res.TypedArray)2 ViewGroup (android.view.ViewGroup)2 AbsListView (android.widget.AbsListView)2 AdapterView (android.widget.AdapterView)2 ImageView (android.widget.ImageView)2 ScrollView (android.widget.ScrollView)2 SuppressLint (android.annotation.SuppressLint)1 TargetApi (android.annotation.TargetApi)1 Point (android.graphics.Point)1 GLSurfaceView (android.opengl.GLSurfaceView)1 MarginLayoutParams (android.view.ViewGroup.MarginLayoutParams)1 ViewTreeObserver (android.view.ViewTreeObserver)1