本文整理汇总了Java中android.widget.ProgressBar.setLayoutParams方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressBar.setLayoutParams方法的具体用法?Java ProgressBar.setLayoutParams怎么用?Java ProgressBar.setLayoutParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ProgressBar
的用法示例。
在下文中一共展示了ProgressBar.setLayoutParams方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import android.widget.ProgressBar; //导入方法依赖的package包/类
public static LinearLayout create(Context context) {
LinearLayout root = new LinearLayout(context);
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
root.setLayoutParams(params);
root.setOrientation(LinearLayout.VERTICAL);
ProgressBar bar = new ProgressBar(context);
LinearLayout.LayoutParams barParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
bar.setLayoutParams(barParams);
SizeHelper.prepare(context);
int padding = SizeHelper.fromPxWidth(20);
bar.setPadding(padding, padding, padding, padding);
root.addView(bar);
return root;
}
示例2: onPreExecute
import android.widget.ProgressBar; //导入方法依赖的package包/类
protected void onPreExecute() {
super.onPreExecute();
// Replace the ListView with a ProgressBar
mProgBar = new ProgressBar(EDFileChooserActivity.this, null,
android.R.attr.progressBarStyleLarge);
// Set the layout to fill the screen
mListView = EDFileChooserActivity.this.getListView();
mLayout = (LinearLayout) mListView.getParent();
mLayout.setGravity(Gravity.CENTER);
mLayout.setLayoutParams(new FrameLayout.LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
// Set the ProgressBar in the center of the layout
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
layoutParams.gravity = Gravity.CENTER;
mProgBar.setLayoutParams(layoutParams);
// Replace the ListView with the ProgressBar
mLayout.removeView(mListView);
mLayout.addView(mProgBar);
mProgBar.setVisibility(View.VISIBLE);
}
示例3: getView
import android.widget.ProgressBar; //导入方法依赖的package包/类
@Override
public View getView() {
FrameLayout root = new FrameLayout(mContext);
root.setBackgroundColor(Color.WHITE);
mWebView = new WebView(mContext);//mContext.getApplicationContext();
FrameLayout.LayoutParams wvLayoutParams =
new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.MATCH_PARENT);
wvLayoutParams.gravity = Gravity.CENTER;
mWebView.setLayoutParams(wvLayoutParams);
root.addView(mWebView);
initWebView(mWebView);
mProgressBar = new ProgressBar(mContext);
showProgressBar(false);
FrameLayout.LayoutParams pLayoutParams =
new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT);
mProgressBar.setLayoutParams(pLayoutParams);
pLayoutParams.gravity = Gravity.CENTER;
root.addView(mProgressBar);
return root;
}
示例4: getVideoLoadingProgressView
import android.widget.ProgressBar; //导入方法依赖的package包/类
/**
* Ask the host application for a custom progress view to show while
* a <video> is loading.
* @return View The progress view.
*/
public View getVideoLoadingProgressView() {
if (mVideoProgressView == null) {
// Create a new Loading view programmatically.
// create the linear layout
LinearLayout layout = new LinearLayout(parentEngine.getView().getContext());
layout.setOrientation(LinearLayout.VERTICAL);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
layout.setLayoutParams(layoutParams);
// the proress bar
ProgressBar bar = new ProgressBar(parentEngine.getView().getContext());
LinearLayout.LayoutParams barLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
barLayoutParams.gravity = Gravity.CENTER;
bar.setLayoutParams(barLayoutParams);
layout.addView(bar);
mVideoProgressView = layout;
}
return mVideoProgressView;
}
示例5: onCreateView
import android.widget.ProgressBar; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
ProgressBar progressBar = new ProgressBar(container.getContext());
if (container instanceof FrameLayout) {
Resources res = getResources();
int width = res.getDimensionPixelSize(R.dimen.spinner_width);
int height = res.getDimensionPixelSize(R.dimen.spinner_height);
FrameLayout.LayoutParams layoutParams =
new FrameLayout.LayoutParams(width, height, Gravity.CENTER);
progressBar.setLayoutParams(layoutParams);
}
return progressBar;
}
示例6: onCreate
import android.widget.ProgressBar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
LinearLayout linearLayout = new LinearLayout(getContext());
ProgressBar progressBar = new ProgressBar(getContext());
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(125,
125);
params.setMargins(100, 20, 100, 20);
progressBar.setLayoutParams(params);
linearLayout.addView(progressBar);
setContentView(linearLayout);
}
示例7: layoutDesign
import android.widget.ProgressBar; //导入方法依赖的package包/类
@SuppressLint("InlinedApi")
private void layoutDesign() {
setOrientation(LinearLayout.VERTICAL);
FrameLayout.LayoutParams lParams0 = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.WRAP_CONTENT);
setLayoutParams(lParams0);
setBackgroundColor(Color.TRANSPARENT);
ProgressBar progressBar = new ProgressBar(mContext);
progressBar.setBackgroundColor(Color.TRANSPARENT);
LayoutParams lParams1 = new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
lParams1.gravity = Gravity.CENTER;
progressBar.setLayoutParams(lParams1);
addView(progressBar);
TextView textView = new TextView(mContext);
textView.setText(mMessage);
LayoutParams lParams2 = new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.WRAP_CONTENT);
lParams2.gravity = Gravity.CENTER;
lParams2.width = mScreenWidth;
textView.setGravity(Gravity.CENTER);
textView.setLayoutParams(lParams2);
textView.setBackgroundColor(Color.TRANSPARENT);
textView.setPadding(mMessagePadding, mMessagePadding, mMessagePadding, mMessagePadding);
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mTextSize);
textView.setTextColor(0xffe5e5e5);
addView(textView);
}
示例8: onCreateView
import android.widget.ProgressBar; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
ProgressBar progressBar = new ProgressBar(container.getContext());
if (container instanceof FrameLayout) {
FrameLayout.LayoutParams layoutParams =
new FrameLayout.LayoutParams(SPINNER_WIDTH, SPINNER_HEIGHT, Gravity.CENTER);
progressBar.setLayoutParams(layoutParams);
}
return progressBar;
}
示例9: onCreateView
import android.widget.ProgressBar; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
ProgressBar progressBar = new ProgressBar(container.getContext());
if (container instanceof FrameLayout) {
Resources res = getResources();
int width = res.getDimensionPixelSize(R.dimen.spinner_width);
int height = res.getDimensionPixelSize(R.dimen.spinner_height);
FrameLayout.LayoutParams layoutParams =
new FrameLayout.LayoutParams(width, height, Gravity.CENTER);
progressBar.setLayoutParams(layoutParams);
}
return progressBar;
}
示例10: ProgressWebView
import android.widget.ProgressBar; //导入方法依赖的package包/类
public ProgressWebView(Context context, AttributeSet attrs) {
super(context, attrs);
mProgressBar = new ProgressBar(context, null, android.R.attr.progressBarStyleHorizontal);
mProgressBar.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, 8, 0, 0));
Drawable drawable = context.getResources().getDrawable(R.drawable.progressbar_webview);
mProgressBar.setProgressDrawable(drawable);
addView(mProgressBar);
setWebChromeClient(new WebChromeClient());
//是否可以缩放
getSettings().setSupportZoom(true);
getSettings().setBuiltInZoomControls(true);
}
示例11: init
import android.widget.ProgressBar; //导入方法依赖的package包/类
private void init(Context context) {
setBackgroundColor(WXResourceUtils.getColor("#ee000000"));
mProgressBar = new ProgressBar(context);
FrameLayout.LayoutParams pLayoutParams =
new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT);
mProgressBar.setLayoutParams(pLayoutParams);
pLayoutParams.gravity = Gravity.CENTER;
addView(mProgressBar);
getViewTreeObserver().addOnGlobalLayoutListener(this);
}
示例12: getVideoLoadingProgressView
import android.widget.ProgressBar; //导入方法依赖的package包/类
@Override
/**
* Ask the host application for a custom progress view to show while
* a <video> is loading.
* @return View The progress view.
*/
public View getVideoLoadingProgressView() {
if (mVideoProgressView == null) {
// Create a new Loading view programmatically.
// create the linear layout
LinearLayout layout = new LinearLayout(parentEngine.getView().getContext());
layout.setOrientation(LinearLayout.VERTICAL);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
layout.setLayoutParams(layoutParams);
// the proress bar
ProgressBar bar = new ProgressBar(parentEngine.getView().getContext());
LinearLayout.LayoutParams barLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
barLayoutParams.gravity = Gravity.CENTER;
bar.setLayoutParams(barLayoutParams);
layout.addView(bar);
mVideoProgressView = layout;
}
return mVideoProgressView;
}
示例13: showProgressBar
import android.widget.ProgressBar; //导入方法依赖的package包/类
public static <T extends Activity> ProgressBar showProgressBar(T context) {
ProgressBar bar = new ProgressBar(context);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.gravity = Gravity.CENTER;
bar.setLayoutParams(params);
ViewGroup vg = (ViewGroup) context.getWindow().getDecorView();
vg.addView(bar);
return bar;
}
示例14: ProgressWebView
import android.widget.ProgressBar; //导入方法依赖的package包/类
public ProgressWebView(Context context, AttributeSet attrs) {
super(context, attrs);
progressBar = new ProgressBar(context, null, android.R.attr.progressBarStyleHorizontal);
progressBar.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
10, 0, 0));
Drawable drawable = context.getResources().getDrawable(R.drawable.progress_bar_states);
progressBar.setProgressDrawable(drawable);
addView(progressBar);
setWebChromeClient(new WebChromeClient());
getSettings().setSupportZoom(true);//支持缩放
getSettings().setBuiltInZoomControls(true);
}
示例15: onCreateView
import android.widget.ProgressBar; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
ProgressBar progressBar = new ProgressBar(container.getContext());
if (container instanceof FrameLayout) {
Resources res = getResources();
int width = res.getDimensionPixelSize(R.dimen.spinner_width);
int height = res.getDimensionPixelSize(R.dimen.spinner_height);
FrameLayout.LayoutParams layoutParams =
new FrameLayout.LayoutParams(width, height, Gravity.CENTER);
progressBar.setLayoutParams(layoutParams);
}
return progressBar;
}