当前位置: 首页>>代码示例>>Java>>正文


Java FrameLayout.getContext方法代码示例

本文整理汇总了Java中android.widget.FrameLayout.getContext方法的典型用法代码示例。如果您正苦于以下问题:Java FrameLayout.getContext方法的具体用法?Java FrameLayout.getContext怎么用?Java FrameLayout.getContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.FrameLayout的用法示例。


在下文中一共展示了FrameLayout.getContext方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateLoadViewHolder

import android.widget.FrameLayout; //导入方法依赖的package包/类
@Override
public LoadViewHolder onCreateLoadViewHolder(ViewGroup parent) {
    FrameLayout frameLayout = new FrameLayout(parent.getContext());
    frameLayout.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER));

    Button loadMoreButton = new Button(frameLayout.getContext());
    //if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) loadMoreButton.setTextAppearance(android.support.design.R.style.Widget_AppCompat_Button_Borderless);
    loadMoreButton.setText(R.string.load_more);
    loadMoreButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            loadIfNeeded();
        }
    });
    frameLayout.addView(loadMoreButton);

    ProgressBar loadingProgressBar = new ProgressBar(frameLayout.getContext());
    frameLayout.addView(loadingProgressBar);

    TextView noMoreResultsTextView = new TextView(frameLayout.getContext());
    noMoreResultsTextView.setGravity(Gravity.CENTER);
    noMoreResultsTextView.setText(R.string.no_more_results);
    frameLayout.addView(noMoreResultsTextView);

    return new LoadViewHolder(frameLayout, loadMoreButton, loadingProgressBar, noMoreResultsTextView);
}
 
开发者ID:ShreckYe,项目名称:SCUYouth,代码行数:27,代码来源:ContentListItemAdapter.java

示例2: addBGChild

import android.widget.FrameLayout; //导入方法依赖的package包/类
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);
    }
 
开发者ID:Justson,项目名称:AgentWeb,代码行数:14,代码来源:BounceWebFragment.java

示例3: initView

import android.widget.FrameLayout; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:liying2008,项目名称:Simpler,代码行数:36,代码来源:PictureFragment.java


注:本文中的android.widget.FrameLayout.getContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。