Java Code Examples for android.widget.ProgressBar#setLayoutParams()
The following examples show how to use
android.widget.ProgressBar#setLayoutParams() .
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: FeedAdapter.java From dtube-mobile-unofficial with Apache License 2.0 | 6 votes |
@NonNull @Override public FeedAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { int layoutid = tvMode ? R.layout.feed_item_tv : R.layout.feed_item; if (viewType == TYPE_VIDEO) { // create a new view LinearLayout v = (LinearLayout) LayoutInflater.from(parent.getContext()) .inflate(layoutid, parent, false); if (tvMode) { if (Preferences.darkMode) v.findViewById(R.id.feed_item_desc_holder).setBackgroundColor(c.getResources().getColor(R.color.transparentBlack)); v.setLayoutParams(new LinearLayout.LayoutParams(Tools.numtodp(400, c), ViewGroup.LayoutParams.WRAP_CONTENT)); } else v.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); // set the view's size, margins, paddings and layout parameters return new ViewHolder(v, TYPE_VIDEO); }else { ProgressBar pb = new ProgressBar(c); if (tvMode) pb.setLayoutParams(new LinearLayout.LayoutParams(Tools.numtodp(400, c), Tools.numtodp(267, c))); return new ViewHolder(pb, TYPE_LOADER); } }
Example 2
Source File: SlideShowView.java From android-slideshow-widget with Apache License 2.0 | 6 votes |
@Override protected void onFinishInflate() { // Check if we have a progress indicator as a child, if not, create one progressIndicator = findViewById(R.id.progress_indicator); if (progressIndicator == null) { ProgressBar pb = new ProgressBar(getContext(), null, android.R.attr.progressBarStyleHorizontal); pb.setIndeterminate(true); LayoutParams lp = new LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); lp.addRule(RelativeLayout.ALIGN_PARENT_LEFT); pb.setLayoutParams(lp); progressIndicator = pb; } else { removeView(progressIndicator); } super.onFinishInflate(); }
Example 3
Source File: ProgressWebView.java From Bailan with Apache License 2.0 | 6 votes |
public ProgressWebView(Context context, AttributeSet attrs) { super(context, attrs); progressbar = new ProgressBar(context, null, android.R.attr.progressBarStyleHorizontal); progressbar.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, 10, 0, 0)); Drawable drawable = context.getResources().getDrawable(R.drawable.progress_bar_states); progressbar.setProgressDrawable(drawable); addView(progressbar); // setWebViewClient(new WebViewClient(){}); setWebChromeClient(new WebChromeClient()); //是否可以缩放 getSettings().setSupportZoom(true); getSettings().setBuiltInZoomControls(true); }
Example 4
Source File: X5WebChromeClient.java From cordova-plugin-x5-webview with Apache License 2.0 | 6 votes |
/** * 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; }
Example 5
Source File: CreateGroupChatActivity.java From NaviBee with GNU General Public License v3.0 | 6 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_confirm, menu); ProgressBar pb = new ProgressBar(this); MenuItem progressItem = menu.findItem(R.id.menu_confirm_progress); int px = (int) (24 * Resources.getSystem().getDisplayMetrics().density); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(3*px, 3*px); pb.setLayoutParams(lp); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { pb.setIndeterminateTintList( ColorStateList.valueOf(0xff000000) ); } pb.setPaddingRelative(px, px, px, px); progressItem.setActionView(pb); return true; }
Example 6
Source File: LoaderImageView.java From callerid-for-android with GNU General Public License v3.0 | 6 votes |
/** * First time loading of the LoaderImageView * Sets up the LayoutParams of the view, you can change these to * get the required effects you want */ private void instantiate(final Context context, final String imageUrl) { mContext = context; mImage = new ImageView(mContext); mImage.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); mSpinner = new ProgressBar(mContext); mSpinner.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); mSpinner.setIndeterminate(true); addView(mSpinner); addView(mImage); if(imageUrl == null){ spin(); }else{ setImageDrawable(imageUrl); } }
Example 7
Source File: ImageViewFromUrl.java From zhangshangwuda with Apache License 2.0 | 6 votes |
private void init(Context context) { mContext=context; // init layout params LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); params.gravity = Gravity.CENTER; // loading progress bar mLoading = new ProgressBar(context); mLoading.setLayoutParams(params); mLoading.setProgress(android.R.attr.progressBarStyleSmall); // image view to display the bitmap mImage = new ImageView(context); mImage.setLayoutParams(params); removeAllViews(); addView(mLoading); addView(mImage); }
Example 8
Source File: CordovaChromeClient.java From reader with MIT License | 5 votes |
@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(this.appView.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(this.appView.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; }
Example 9
Source File: BrowseErrorActivity.java From TvAppRepo with Apache License 2.0 | 5 votes |
@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; }
Example 10
Source File: WXVideoView.java From weex-uikit with MIT License | 5 votes |
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); }
Example 11
Source File: ViewMaker.java From iGap-Android with GNU Affero General Public License v3.0 | 5 votes |
static View getProgressWaitingItem() { ProgressBar cslp_progress_bar_waiting = new ProgressBar(G.context); cslp_progress_bar_waiting.setId(R.id.cslp_progress_bar_waiting); cslp_progress_bar_waiting.setPadding(i_Dp(R.dimen.dp4), i_Dp(R.dimen.dp4), i_Dp(R.dimen.dp4), i_Dp(R.dimen.dp4)); cslp_progress_bar_waiting.setVisibility(View.VISIBLE); FrameLayout.LayoutParams layout_842 = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); layout_842.gravity = Gravity.CENTER; cslp_progress_bar_waiting.setIndeterminate(true); cslp_progress_bar_waiting.setLayoutParams(layout_842); return cslp_progress_bar_waiting; }
Example 12
Source File: CordovaChromeClient.java From IoTgo_Android_App with MIT License | 5 votes |
@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(this.appView.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(this.appView.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; }
Example 13
Source File: CommonHelper.java From fanfouapp-opensource with Apache License 2.0 | 5 votes |
public static ProgressBar createProgress(final Context context) { final ProgressBar p = new ProgressBar(context); p.setIndeterminate(true); final RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( 40, 40); lp.addRule(RelativeLayout.CENTER_IN_PARENT); p.setLayoutParams(lp); return p; }
Example 14
Source File: FragmentArtists.java From freemp with Apache License 2.0 | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { activity = getActivity(); aq = new AQuery(activity); //UI final LinearLayout linearLayout = new LinearLayout(activity); linearLayout.setOrientation(LinearLayout.VERTICAL); //Progress progressBar = new ProgressBar(activity, null, android.R.attr.progressBarStyleHorizontal); ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); progressBar.setLayoutParams(layoutParams); progressBar.setVisibility(View.GONE); gridView = new GridView(activity); gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (adapter == null) return; ClsTrack track = (ClsTrack) adapter.getItem(position); final String artist = track.getArtist(); ArrayList<ClsTrack> tracks = (ArrayList<ClsTrack>) FileUtils.readObject("alltracksms", activity); ArrayList<ClsTrack> tracksFiltered = new ArrayList<ClsTrack>(); for (ClsTrack t : tracks) { if (t.getArtist().equalsIgnoreCase(artist)) { tracksFiltered.add(t); } } ((ActPlaylist) activity).close(tracksFiltered); } }); linearLayout.addView(progressBar); linearLayout.addView(gridView); return linearLayout; }
Example 15
Source File: SpinnerFragment.java From alltv with MIT License | 5 votes |
@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; }
Example 16
Source File: SystemWebChromeClient.java From keemob with MIT License | 5 votes |
@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; }
Example 17
Source File: CordovaChromeClient.java From bluemix-parking-meter with MIT License | 5 votes |
@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(this.appView.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(this.appView.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; }
Example 18
Source File: ManageDataLauncherActivity.java From android-browser-helper with Apache License 2.0 | 5 votes |
/** * Override to customize loading view, or return null if not needed. */ @Nullable protected View createLoadingView() { ProgressBar progressBar = new ProgressBar(this); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT); params.gravity = Gravity.CENTER; progressBar.setLayoutParams(params); FrameLayout layout = new FrameLayout(this); layout.addView(progressBar); return layout; }
Example 19
Source File: SystemWebChromeClient.java From xmall with MIT License | 5 votes |
@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; }
Example 20
Source File: OAuthManagerDialogFragment.java From react-native-oauth with MIT License | 4 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Context context = mReactContext; LayoutParams rootViewLayoutParams = this.getFullscreenLayoutParams(context); RelativeLayout rootView = new RelativeLayout(context); mProgressBar = new ProgressBar(context); RelativeLayout.LayoutParams progressParams = new RelativeLayout.LayoutParams(convertDpToPixel(50f,context),convertDpToPixel(50f,context)); progressParams.addRule(RelativeLayout.CENTER_IN_PARENT); mProgressBar.setLayoutParams(progressParams); mProgressBar.setIndeterminate(true); getDialog().setCanceledOnTouchOutside(true); rootView.setLayoutParams(rootViewLayoutParams); // mWebView = (AdvancedWebView) rootView.findViewById(R.id.webview); Log.d(TAG, "Creating webview"); mWebView = new AdvancedWebView(context); // mWebView.setId(WEBVIEW_TAG); mWebView.setListener(this, this); mWebView.setVisibility(View.VISIBLE); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setDomStorageEnabled(true); LayoutParams layoutParams = this.getFullscreenLayoutParams(context); //new LayoutParams( // LayoutParams.FILL_PARENT, // DIALOG_HEIGHT // ); // mWebView.setLayoutParams(layoutParams); rootView.addView(mWebView, layoutParams); rootView.addView(mProgressBar,progressParams); // LinearLayout pframe = new LinearLayout(context); // pframe.setId(WIDGET_TAG); // pframe.setOrientation(LinearLayout.VERTICAL); // pframe.setVisibility(View.GONE); // pframe.setGravity(Gravity.CENTER); // pframe.setLayoutParams(layoutParams); // rootView.addView(pframe, layoutParams); this.setupWebView(mWebView); mController.getRequestTokenUrlAndLoad(mWebView); Log.d(TAG, "Loading view..."); return rootView; }