android.widget.FrameLayout#getContext ( )源码实例Demo

下面列出了android.widget.FrameLayout#getContext ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: animation-samples   文件: ViewUtils.java
/**
 * Create a color change animation over a foreground property of a {@link FrameLayout}.
 *
 * @param target The target view.
 * @param startColorRes The color to start from.
 * @param targetColorRes The color this animation will end with.
 * @param interpolator The interpolator to use.
 * @return The color change animation.
 */
@NonNull
public static ObjectAnimator createColorChange(@NonNull FrameLayout target,
                                               @ColorRes int startColorRes,
                                               @ColorRes int targetColorRes,
                                               @NonNull Interpolator interpolator) {
    Context context = target.getContext();
    final int startColor = ContextCompat.getColor(context, startColorRes);
    final int targetColor = ContextCompat.getColor(context, targetColorRes);
    ObjectAnimator colorChange = ObjectAnimator.ofInt(target,
            ViewUtils.FOREGROUND_COLOR, startColor, targetColor);
    colorChange.setEvaluator(new ArgbEvaluator());
    colorChange.setInterpolator(interpolator);
    colorChange.setDuration(context.getResources()
            .getInteger(android.R.integer.config_longAnimTime));
    return colorChange;
}
 
/**
 * {@inheritDoc}
 */
@Override
public void init(@NonNull FrameLayout parent) {
    mSurfaceView = new TransformableSurfaceView(parent.getContext());
    mSurfaceView.setLayoutParams(
            new FrameLayout.LayoutParams(
                    FrameLayout.LayoutParams.MATCH_PARENT,
                    FrameLayout.LayoutParams.MATCH_PARENT));
    parent.addView(mSurfaceView);
    mSurfaceView.getHolder().addCallback(mSurfaceRequestCallback);
}
 
源代码3 项目: TemplateAppProject   文件: AgentWebFragment.java
protected void addBackgroundChild(FrameLayout frameLayout) {
    TextView textView = new TextView(frameLayout.getContext());
    textView.setText("技术由 AgentWeb 提供");
    textView.setTextSize(16);
    textView.setTextColor(Color.parseColor("#727779"));
    frameLayout.setBackgroundColor(Color.parseColor("#272b2d"));
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(-2, -2);
    params.gravity = Gravity.CENTER_HORIZONTAL;
    final float scale = frameLayout.getContext().getResources().getDisplayMetrics().density;
    params.topMargin = (int) (15 * scale + 0.5f);
    frameLayout.addView(textView, 0, params);
}
 
源代码4 项目: TemplateAppProject   文件: XPageWebViewFragment.java
protected void addBackgroundChild(FrameLayout frameLayout) {
    TextView textView = new TextView(frameLayout.getContext());
    textView.setText("技术由 AgentWeb 提供");
    textView.setTextSize(16);
    textView.setTextColor(Color.parseColor("#727779"));
    frameLayout.setBackgroundColor(Color.parseColor("#272b2d"));
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(-2, -2);
    params.gravity = Gravity.CENTER_HORIZONTAL;
    final float scale = frameLayout.getContext().getResources().getDisplayMetrics().density;
    params.topMargin = (int) (15 * scale + 0.5f);
    frameLayout.addView(textView, 0, params);
}
 
源代码5 项目: styT   文件: Main4Activity.java
protected void addBGChild(FrameLayout frameLayout) {

        TextView mTextView = new TextView(frameLayout.getContext());
        mTextView.setText("技术由 AgentWeb 提供");
        mTextView.setTextSize(16);
        mTextView.setTextColor(Color.parseColor("#727779"));
        frameLayout.setBackgroundColor(Color.parseColor("#272b2d"));
        FrameLayout.LayoutParams mFlp = new FrameLayout.LayoutParams(-2, -2);
        mFlp.gravity = Gravity.CENTER_HORIZONTAL;
        final float scale = frameLayout.getContext().getResources().getDisplayMetrics().density;
        mFlp.topMargin = (int) (15 * scale + 0.5f);
        frameLayout.addView(mTextView, 0, mFlp);
    }
 
源代码6 项目: WanAndroid   文件: ArticleActivity.java
/**
 * 设置下拉回弹的文字
 */
protected void addBgChild(FrameLayout frameLayout) {
    TextView textView = new TextView(frameLayout.getContext());
    textView.setText(R.string.articleActivity_support);
    textView.setTextSize(16);
    textView.setTextColor(Color.parseColor("#727779"));
    frameLayout.setBackgroundColor(Color.parseColor("#272b2d"));
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(-2, -2);
    params.gravity = Gravity.CENTER_HORIZONTAL;
    final float scale = frameLayout.getContext().getResources().getDisplayMetrics().density;
    params.topMargin = (int) (30 * scale + 0.5f);
    frameLayout.addView(textView, 0, params);
}
 
源代码7 项目: DataBindingAdapter   文件: SingleTextEmptyView.java
@Override
public View onCreateEmptyView(FrameLayout parent)
{
    TextView textView = new TextView(parent.getContext());
    textView.setText(mEmptyText);
    textView.setTextColor(mTextColor);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    textView.setGravity(Gravity.CENTER);

    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    params.gravity = Gravity.CENTER;
    textView.setLayoutParams(params);
    return textView;
}
 
源代码8 项目: AgentWeb   文件: BounceWebFragment.java
protected void addBGChild(FrameLayout frameLayout) {

		TextView mTextView = new TextView(frameLayout.getContext());
		mTextView.setText("技术由 AgentWeb 提供");
		mTextView.setTextSize(16);
		mTextView.setTextColor(Color.parseColor("#727779"));
		frameLayout.setBackgroundColor(Color.parseColor("#272b2d"));
		FrameLayout.LayoutParams mFlp = new FrameLayout.LayoutParams(-2, -2);
		mFlp.gravity = Gravity.CENTER_HORIZONTAL;
		final float scale = frameLayout.getContext().getResources().getDisplayMetrics().density;
		mFlp.topMargin = (int) (15 * scale + 0.5f);
		frameLayout.addView(mTextView, 0, mFlp);
	}
 
源代码9 项目: Simpler   文件: PictureFragment.java
private void initView(FrameLayout frameLayout) {
    FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
    layoutParams.gravity = Gravity.CENTER;
    /* 图片加载进度圈 */
    CircleProgress progress = getProgressView(getActivity());
    mProgressModelLoader = new ProgressModelLoader(getHandler(progress));

    if (url.endsWith(".gif")) {
        GifMovieView gifView = new GifMovieView(frameLayout.getContext());
        gifView.setLayoutParams(layoutParams);
        gifView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // 点击图片返回
                getActivity().onBackPressed();
            }
        });
        frameLayout.addView(gifView);
        progress.inject(gifView);
        loadPic(url, gifView, true);
    } else {
        PhotoView photoView = new PhotoView(frameLayout.getContext());
        photoView.setLayoutParams(layoutParams);
        photoView.setOnPhotoTapListener(new OnPhotoTapListener() {
            @Override
            public void onPhotoTap(ImageView view, float x, float y) {
                // 点击图片返回
                getActivity().onBackPressed();
            }
        });
        frameLayout.addView(photoView);
        progress.inject(photoView);
        loadPic(url, photoView, false);
    }
}
 
源代码10 项目: appcan-android   文件: EBrowserWidgetPool.java
public EBrowserWidgetPool(EBrowser inBrw, FrameLayout window,
                          EBrowserAround inShelter) {
    mBrw = inBrw;
    mNativeWindow = window;
    mBrowserAround = inShelter;
    mSpaceWidgetResu = new EWgtResultInfo(null, null);
    mWgtStack = new EWidgetStack();
    mContext = (EBrowserActivity) window.getContext();
    mWidPoolLoop = new PoolHandler(Looper.getMainLooper());
    mEBrowserWidgetPool=this;
}