Java Code Examples for android.widget.FrameLayout#getContext()
The following examples show how to use
android.widget.FrameLayout#getContext() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ViewUtils.java From animation-samples with Apache License 2.0 | 6 votes |
/** * 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; }
Example 2
Source File: SurfaceViewImplementation.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
/** * {@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); }
Example 3
Source File: AgentWebFragment.java From TemplateAppProject with Apache License 2.0 | 5 votes |
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); }
Example 4
Source File: XPageWebViewFragment.java From TemplateAppProject with Apache License 2.0 | 5 votes |
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); }
Example 5
Source File: Main4Activity.java From styT with Apache License 2.0 | 5 votes |
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); }
Example 6
Source File: ArticleActivity.java From WanAndroid with Apache License 2.0 | 5 votes |
/** * 设置下拉回弹的文字 */ 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); }
Example 7
Source File: SingleTextEmptyView.java From DataBindingAdapter with MIT License | 5 votes |
@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; }
Example 8
Source File: BounceWebFragment.java From AgentWeb with Apache License 2.0 | 5 votes |
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); }
Example 9
Source File: PictureFragment.java From Simpler with Apache License 2.0 | 5 votes |
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); } }
Example 10
Source File: EBrowserWidgetPool.java From appcan-android with GNU Lesser General Public License v3.0 | 5 votes |
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; }