List of usage examples for android.view View inflate
public static View inflate(Context context, @LayoutRes int resource, ViewGroup root)
From source file:Main.java
public static void injectViewInLayout(ViewGroup viewGroup, int id) { View view = View.inflate(viewGroup.getContext(), id, null); view.setId(id);//from www . j av a 2 s . c o m viewGroup.addView(view); }
From source file:com.chengx.mvp.widget.loadding.CustomDialog.java
public static CustomDialog instance(Activity activity) { LoadingView v = (LoadingView) View.inflate(activity, R.layout.common_progress_view, null); v.setColor(ContextCompat.getColor(activity, R.color.reader_menu_bg_color)); CustomDialog dialog = new CustomDialog(activity, R.style.loading_dialog); dialog.setContentView(v, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); return dialog; }
From source file:com.siso.app.adapter.GoodsDetailAdapter.java
/** * //from w w w . ja v a 2 s . c om * @author Owater * @createtime 2015-3-30 ?2:44:30 * @Decription ? * */ private void initBanner(View convertView, ViewHolder viewHolder) { ArrayList<View> viewlist = new ArrayList<View>(); viewHolder.viewPager = (ViewPager) convertView.findViewById(R.id.item_goods_detail_viewpager); viewHolder.mIndicator = (CirclePageIndicator) convertView.findViewById(R.id.indicator); if (entity.getGoodImages() != null) { String imgUrl[] = CommonUtils.getImgArr(entity.getGoodImages()); for (int i = 0; i < imgUrl.length; i++) { View view = convertView.inflate(context, R.layout.item_banner_view, null); viewlist.add(view); } BannerAdapter bannerAdapter = new BannerAdapter(context, viewlist, imgUrl); viewHolder.viewPager.setAdapter(bannerAdapter); viewHolder.mIndicator.setViewPager(viewHolder.viewPager); } // listItemView.content = (TextView)convertView.findViewById(R.id.item_goods_detail_viewpager_text); // listItemView.content.setText("viewpager"); // convertView.setTag(listItemView); }
From source file:com.kukumoraketo.emojibrowser.AboutDialogFragment.java
@NonNull @Override//from w ww. j a v a 2 s . c o m public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); View mainView = View.inflate(getContext(), R.layout.dialog_about, null); builder.setView(mainView); builder.setPositiveButton(R.string.about_positiveButton, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); //region sets text TextView aboutContent = (TextView) mainView.findViewById(R.id.about_content_TextView); aboutContent.setText(Html.fromHtml(getString(R.string.about_content))); aboutContent.setMovementMethod(LinkMovementMethod.getInstance()); TextView licenseContent = (TextView) mainView.findViewById(R.id.about_license_content_TextView); licenseContent.setText(Html.fromHtml(getString(R.string.about_license_content))); licenseContent.setMovementMethod(LinkMovementMethod.getInstance()); //endregion return builder.create(); }
From source file:org.feedhenry.saml.fragments.LoadingFragment.java
@Nullable @Override/*from ww w . j a v a2 s .c o m*/ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return View.inflate(getActivity(), R.layout.fragment_loading, null); }
From source file:com.google.android.cameraview.SurfaceViewPreview.java
SurfaceViewPreview(Context context, ViewGroup parent) { final View view = View.inflate(context, R.layout.surface_view, parent); mSurfaceView = (SurfaceView) view.findViewById(R.id.surface_view); final SurfaceHolder holder = mSurfaceView.getHolder(); //noinspection deprecation holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); holder.addCallback(new SurfaceHolder.Callback() { @Override//from w w w. j a v a 2s . c o m public void surfaceCreated(SurfaceHolder h) { } @Override public void surfaceChanged(SurfaceHolder h, int format, int width, int height) { setSize(width, height); if (!ViewCompat.isInLayout(mSurfaceView)) { dispatchSurfaceChanged(); } } @Override public void surfaceDestroyed(SurfaceHolder h) { setSize(0, 0); } }); }
From source file:com.brotherpowers.cameraview.SurfaceViewPreview.java
SurfaceViewPreview(Context context, ViewGroup parent) { final View view = View.inflate(context, R.layout.surface_view, parent); mSurfaceView = (SurfaceView) view.findViewById(R.id.surface_view); final SurfaceHolder holder = mSurfaceView.getHolder(); //noinspection deprecation holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); holder.addCallback(new SurfaceHolder.Callback() { @Override//from w w w . jav a 2 s. c om public void surfaceCreated(SurfaceHolder h) { } @Override public void surfaceChanged(SurfaceHolder h, int format, int width, int height) { setSize(width, height); if (!ViewCompat.isInLayout(mSurfaceView)) { dispatchSurfaceChanged(); } } @Override public void surfaceDestroyed(SurfaceHolder h) { setSize(0, 0); } }); }
From source file:butter.droid.base.fragments.dialog.ChangeLogDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { ChangeLogRecyclerView chgList = (ChangeLogRecyclerView) View.inflate(getActivity(), R.layout.fragment_dialog_changelog, null); return new AlertDialog.Builder(getActivity()).setTitle(R.string.changelog).setView(chgList) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.dismiss();/*from w w w . j a v a 2s . co m*/ } }).create(); }
From source file:org.feedhenry.blank.InitFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = View.inflate(getActivity(), R.layout.init_fragment, null); FH.init(getActivity(), new FHActCallback() { @Override/* w w w .j av a2 s.co m*/ public void success(FHResponse fhResponse) { Log.d(TAG, "init - success"); MainActivity activity = (MainActivity) getActivity(); activity.navigateToHome("Yay, this app is ready to go!"); //NOTE: other FH methods can only be called after FH.init succeeds } @Override public void fail(FHResponse fhResponse) { Log.d(TAG, "init - fail"); Log.e(TAG, fhResponse.getErrorMessage(), fhResponse.getError()); MainActivity activity = (MainActivity) getActivity(); activity.navigateToHome("Oops, an error occurred while processing FH.init"); } }); return view; }
From source file:com.leinardi.ubuntucountdownwidget.ui.dialogs.ChangelogDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { View changelogView = View.inflate(getActivity(), R.layout.dialog_changelog, null); return new AlertDialog.Builder(getActivity(), R.style.AppCompatAlertDialogTheme) .setTitle(R.string.changelog_title).setView(changelogView) .setPositiveButton(R.string.close, new DialogInterface.OnClickListener() { @Override/* w w w . j a va 2s.co m*/ public void onClick(DialogInterface dialog, int which) { dismiss(); } }).create(); }