本文整理汇总了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);
}
示例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);
}
示例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);
}
}