Search in sources :

Example 71 with FrameLayout

use of android.widget.FrameLayout in project cw-omnibus by commonsguy.

the class RowController method measureContentWidth.

// based on http://stackoverflow.com/a/26814964/115145
private int measureContentWidth(Context ctxt, ListAdapter listAdapter) {
    ViewGroup mMeasureParent = null;
    int maxWidth = 0;
    View itemView = null;
    int itemType = 0;
    final ListAdapter adapter = listAdapter;
    final int widthMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
    final int heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
    final int count = adapter.getCount();
    for (int i = 0; i < count; i++) {
        final int positionType = adapter.getItemViewType(i);
        if (positionType != itemType) {
            itemType = positionType;
            itemView = null;
        }
        if (mMeasureParent == null) {
            mMeasureParent = new FrameLayout(ctxt);
        }
        itemView = adapter.getView(i, itemView, mMeasureParent);
        itemView.measure(widthMeasureSpec, heightMeasureSpec);
        final int itemWidth = itemView.getMeasuredWidth();
        if (itemWidth > maxWidth) {
            maxWidth = itemWidth;
        }
    }
    return maxWidth;
}
Also used : ViewGroup(android.view.ViewGroup) FrameLayout(android.widget.FrameLayout) ImageView(android.widget.ImageView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListAdapter(android.widget.ListAdapter)

Example 72 with FrameLayout

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

the class ParallaxSwipeBackActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    //通过反射来改变SlidingPanelayout的值
    try {
        slidingPaneLayout = new SlidingPaneLayout(this);
        Field f_overHang = SlidingPaneLayout.class.getDeclaredField("mOverhangSize");
        f_overHang.setAccessible(true);
        f_overHang.set(slidingPaneLayout, 0);
        slidingPaneLayout.setPanelSlideListener(this);
        slidingPaneLayout.setSliderFadeColor(getResources().getColor(android.R.color.transparent));
    } catch (Exception e) {
        e.printStackTrace();
    }
    super.onCreate(savedInstanceState);
    mFileTemp = new File(getCacheDir(), WINDOWBITMAP);
    defaultTranslationX = dip2px(defaultTranslationX);
    shadowWidth = dip2px(shadowWidth);
    //behindframeLayout
    FrameLayout behindframeLayout = new FrameLayout(this);
    behindImageView = new ImageView(this);
    behindImageView.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));
    behindframeLayout.addView(behindImageView, 0);
    //containerLayout
    LinearLayout containerLayout = new LinearLayout(this);
    containerLayout.setOrientation(LinearLayout.HORIZONTAL);
    containerLayout.setBackgroundColor(getResources().getColor(android.R.color.transparent));
    containerLayout.setLayoutParams(new ViewGroup.LayoutParams(getWindowManager().getDefaultDisplay().getWidth() + shadowWidth, ViewGroup.LayoutParams.MATCH_PARENT));
    //you view container
    frameLayout = new FrameLayout(this);
    frameLayout.setBackgroundColor(getResources().getColor(android.R.color.white));
    frameLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
    //add shadow
    shadowImageView = new ImageView(this);
    shadowImageView.setBackgroundResource(R.drawable.parallax_swipe_back_shadow);
    shadowImageView.setLayoutParams(new LinearLayout.LayoutParams(shadowWidth, LinearLayout.LayoutParams.MATCH_PARENT));
    containerLayout.addView(shadowImageView);
    containerLayout.addView(frameLayout);
    containerLayout.setTranslationX(-shadowWidth);
    //添加两个view
    slidingPaneLayout.addView(behindframeLayout, 0);
    slidingPaneLayout.addView(containerLayout, 1);
}
Also used : Field(java.lang.reflect.Field) ViewGroup(android.view.ViewGroup) FrameLayout(android.widget.FrameLayout) ImageView(android.widget.ImageView) SlidingPaneLayout(android.support.v4.widget.SlidingPaneLayout) File(java.io.File) LinearLayout(android.widget.LinearLayout)

Example 73 with FrameLayout

use of android.widget.FrameLayout in project philm by chrisbanes.

the class ListFragment method onCreateView.

/**
     * Provide default implementation to return a simple list view.  Subclasses
     * can override to replace with their own layout.  If doing so, the
     * returned view hierarchy <em>must</em> have a ListView whose id
     * is {@link android.R.id#list android.R.id.list} and can optionally
     * have a sibling view id {@link android.R.id#empty android.R.id.empty}
     * that is to be shown when the list is empty.
     *
     * <p>If you are overriding this method with your own custom content,
     * consider including the standard layout {@link android.R.layout#list_content}
     * in your layout file, so that you continue to retain all of the standard
     * behavior of ListFragment.  In particular, this is currently the only
     * way to have the built-in indeterminant progress state be shown.
     */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final Context context = getActivity();
    FrameLayout contentRoot = new FrameLayout(context);
    // ------------------------------------------------------------------
    ProgressBar progress = new ProgressBar(context, null, android.R.attr.progressBarStyleLarge);
    progress.setId(INTERNAL_PROGRESS_ID);
    progress.setVisibility(View.GONE);
    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    lp.gravity = Gravity.CENTER;
    contentRoot.addView(progress, lp);
    // ------------------------------------------------------------------
    FrameLayout lframe = new FrameLayout(context);
    lframe.setId(INTERNAL_LIST_CONTAINER_ID);
    FontTextView tv = new FontTextView(getActivity());
    tv.setId(INTERNAL_EMPTY_ID);
    tv.setGravity(Gravity.CENTER);
    tv.setFont(FontTextView.FONT_ROBOTO_CONDENSED);
    final int p = getResources().getDimensionPixelSize(R.dimen.spacing_major);
    tv.setPadding(p, p, p, p);
    lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
    E lv = createListView(context, inflater);
    lv.setId(android.R.id.list);
    lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
    contentRoot.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
    // ------------------------------------------------------------------
    ProgressBar secondaryProgress = new SmoothProgressBar(context, null, android.R.attr.progressBarStyleHorizontal);
    secondaryProgress.setId(INTERNAL_SECONDARY_PROGRESS_ID);
    secondaryProgress.setVisibility(View.GONE);
    secondaryProgress.setIndeterminate(true);
    contentRoot.addView(secondaryProgress, new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.BOTTOM));
    View root;
    if (getParentFragment() == null) {
        final LinearLayout toolbarRoot = new LinearLayout(context);
        toolbarRoot.setOrientation(LinearLayout.VERTICAL);
        // Finally, add the Toolbar
        inflater.inflate(R.layout.include_toolbar, toolbarRoot, true);
        toolbarRoot.addView(contentRoot, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0, 1f));
        root = toolbarRoot;
    } else {
        root = contentRoot;
    }
    root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    return root;
}
Also used : Context(android.content.Context) ViewGroup(android.view.ViewGroup) FontTextView(app.philm.in.view.FontTextView) AbsListView(android.widget.AbsListView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) FrameLayout(android.widget.FrameLayout) FontTextView(app.philm.in.view.FontTextView) SmoothProgressBar(fr.castorflex.android.smoothprogressbar.SmoothProgressBar) ProgressBar(android.widget.ProgressBar) SmoothProgressBar(fr.castorflex.android.smoothprogressbar.SmoothProgressBar) LinearLayout(android.widget.LinearLayout)

Example 74 with FrameLayout

use of android.widget.FrameLayout in project PermissionsDispatcher by hotchemi.

the class CameraPreviewFragment method initCamera.

private void initCamera() {
    mCamera = getCameraInstance(CAMERA_ID);
    Camera.CameraInfo cameraInfo = null;
    if (mCamera != null) {
        // Get camera info only if the camera is available
        cameraInfo = new Camera.CameraInfo();
        Camera.getCameraInfo(CAMERA_ID, cameraInfo);
    }
    // Get the rotation of the screen to adjust the preview image accordingly.
    final int displayRotation = getActivity().getWindowManager().getDefaultDisplay().getRotation();
    if (getView() == null) {
        return;
    }
    FrameLayout preview = (FrameLayout) getView().findViewById(R.id.camera_preview);
    preview.removeAllViews();
    if (mPreview == null) {
        // Create the Preview view and set it as the content of this Activity.
        mPreview = new CameraPreview(getActivity(), mCamera, cameraInfo, displayRotation);
    } else {
        mPreview.setCamera(mCamera, cameraInfo, displayRotation);
    }
    preview.addView(mPreview);
}
Also used : FrameLayout(android.widget.FrameLayout) Camera(android.hardware.Camera)

Example 75 with FrameLayout

use of android.widget.FrameLayout in project Highlight by hongyangAndroid.

the class HighLight method remove.

@Override
public void remove() {
    if (mHightLightView == null || !mShowing)
        return;
    ViewGroup parent = (ViewGroup) mHightLightView.getParent();
    if (parent instanceof RelativeLayout || parent instanceof FrameLayout) {
        parent.removeView(mHightLightView);
    } else {
        parent.removeView(mHightLightView);
        View origin = parent.getChildAt(0);
        ViewGroup graParent = (ViewGroup) parent.getParent();
        graParent.removeView(parent);
        graParent.addView(origin, parent.getLayoutParams());
    }
    mHightLightView = null;
    if (intercept) {
        //如果拦截才响应移除回调
        sendRemoveMessage();
    }
    mShowing = false;
}
Also used : ViewGroup(android.view.ViewGroup) FrameLayout(android.widget.FrameLayout) RelativeLayout(android.widget.RelativeLayout) HightLightView(zhy.com.highlight.view.HightLightView) View(android.view.View)

Aggregations

FrameLayout (android.widget.FrameLayout)634 View (android.view.View)244 TextView (android.widget.TextView)143 ViewGroup (android.view.ViewGroup)128 ImageView (android.widget.ImageView)95 LinearLayout (android.widget.LinearLayout)89 ListView (android.widget.ListView)54 AdapterView (android.widget.AdapterView)49 Button (android.widget.Button)44 LayoutInflater (android.view.LayoutInflater)42 Bitmap (android.graphics.Bitmap)41 LayoutParams (android.view.ViewGroup.LayoutParams)37 AbsListView (android.widget.AbsListView)37 Context (android.content.Context)35 Intent (android.content.Intent)28 Activity (android.app.Activity)25 TextureView (android.view.TextureView)25 ColorDrawable (android.graphics.drawable.ColorDrawable)23 FileOutputStream (java.io.FileOutputStream)23 Drawable (android.graphics.drawable.Drawable)20