android.view.LayoutInflater Java Examples
The following examples show how to use
android.view.LayoutInflater.
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: ButtonCL_Fragment.java From ui with Apache License 2.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View myView = inflater.inflate(R.layout.constraintlayout_fragment, container, false); //set it up so all the button work in this fragment. (myView.findViewById(R.id.button01)).setOnClickListener(this); (myView.findViewById(R.id.button02)).setOnClickListener(this); (myView.findViewById(R.id.button03)).setOnClickListener(this); (myView.findViewById(R.id.button04)).setOnClickListener(this); (myView.findViewById(R.id.button05)).setOnClickListener(this); (myView.findViewById(R.id.button06)).setOnClickListener(this); (myView.findViewById(R.id.button07)).setOnClickListener(this); (myView.findViewById(R.id.button08)).setOnClickListener(this); (myView.findViewById(R.id.button09)).setOnClickListener(this); (myView.findViewById(R.id.button10)).setOnClickListener(this); (myView.findViewById(R.id.button11)).setOnClickListener(this); //output to the screen. output = myView.findViewById(R.id.output); return myView; }
Example #2
Source File: ExoPlayerWrapperView.java From RedReader with GNU General Public License v3.0 | 6 votes |
private static ImageButton createButton( @NonNull final Context context, @NonNull final ViewGroup root, @DrawableRes final int image, @NonNull final OnClickListener clickListener) { final ImageButton ib = (ImageButton)LayoutInflater.from(context).inflate(R.layout.flat_image_button, root, false); final int buttonPadding = General.dpToPixels(context, 14); ib.setPadding(buttonPadding, buttonPadding, buttonPadding, buttonPadding); ib.setImageResource(image); ib.setOnClickListener(clickListener); return ib; }
Example #3
Source File: PluginSettingsDialog.java From xposed-rimet with Apache License 2.0 | 6 votes |
@Override protected View createView(LayoutInflater layoutInflater, ViewGroup viewGroup) { // 不显示默认标题 getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE); mCommonFrameLayout = new CommonFrameLayout(getContext()); mToolbar = mCommonFrameLayout.getTitleView(); mMoreButton = mToolbar.addMoreImageButton(); LinearLayout content = LayoutUtil.newCommonLayout(getContext()); mListView = new ListView(getContext()); mListView.setCacheColorHint(0x00000000); mListView.setDividerHeight(0); mListView.setLayoutParams(LayoutUtil.newMatchFrameLayoutParams()); content.addView(mListView); mCommonFrameLayout.setContent(content); return mCommonFrameLayout; }
Example #4
Source File: TextRoundCornerProgressBar.java From UltimateAndroid with Apache License 2.0 | 6 votes |
@SuppressLint("NewApi") public TextRoundCornerProgressBar(Context context, AttributeSet attrs) { super(context, attrs); if (!isInEditMode()) { isProgressBarCreated = false; isProgressSetBeforeDraw = false; isMaxProgressSetBeforeDraw = false; isBackgroundColorSetBeforeDraw = false; isProgressColorSetBeforeDraw = false; LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.round_corner_progress_bar_round_corner_with_text_layout, this); setup(context, attrs); isProgressBarCreated = true; } else { if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { setBackground(new ColorDrawable(Color.parseColor("#CCCCCC"))); } else { setBackgroundColor(Color.parseColor("#CCCCCC")); } setGravity(Gravity.CENTER); setPadding(0, (int)dp2px(5), 0, (int)dp2px(5)); TextView tv = new TextView(context); tv.setText("TextRoundCornerProgressBar"); addView(tv); } }
Example #5
Source File: FolderDialog.java From DroidPlay with GNU General Public License v3.0 | 6 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.folder_item, null); // service info File file = getItem(position); // name TextView name = (TextView) view.findViewById(R.id.name); if (file == null) { name.setText("[ .. ]"); } else { name.setText(file.getName()); } return (view); }
Example #6
Source File: MySimpleArrayAdapter.java From codeexamples-android with Eclipse Public License 1.0 | 6 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { View rowView = null; LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); rowView = inflater.inflate(R.layout.rowlayout, parent, false); TextView textView = (TextView) rowView.findViewById(R.id.label); ImageView imageView = (ImageView) rowView.findViewById(R.id.icon); textView.setText(values[position]); // Change the icon for Windows and iPhone String s = values[position]; if (s.startsWith("iPhone")) { imageView.setImageResource(R.drawable.no); } else { imageView.setImageResource(R.drawable.ok); } return rowView; }
Example #7
Source File: PlayDialog.java From xposed-aweme with Apache License 2.0 | 6 votes |
@Override protected View createView(LayoutInflater layoutInflater, ViewGroup viewGroup) { // 不显示默认标题 getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE); mCommonFrameLayout = new CommonFrameLayout(getContext()); mToolbar = mCommonFrameLayout.getTitleView(); mAutoPlayType = ViewUtil.newSpinnerItemView(getContext(), "播放方式", "", PlayUtil.getPlayTypeName(Constant.PlayType.TDEFAULT), PlayUtil.getPlayTypeName(Constant.PlayType.TIMING)); mAutoPlaySleepTime = new EditTextItemView(getContext()); mAutoPlaySleepTime.setName("播放休眠时间"); mAutoPlaySleepTime.setExtendHint("未设置"); mAutoPlaySleepTime.setUnit("秒"); mAutoPlaySleepTime.setInputType(com.sky.xposed.common.Constant.InputType.NUMBER_SIGNED); mCommonFrameLayout.addContent(mAutoPlayType); mCommonFrameLayout.addContent(mAutoPlaySleepTime); return mCommonFrameLayout; }
Example #8
Source File: DashBoard.java From AnLinux-Adfree with Apache License 2.0 | 6 votes |
public void notifyUserForNethunter(){ final ViewGroup nullParent = null; AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity()); LayoutInflater layoutInflater = LayoutInflater.from(getActivity()); View view = layoutInflater.inflate(R.layout.notify1, nullParent); TextView textView = view.findViewById(R.id.textView); alertDialog.setView(view); alertDialog.setCancelable(false); alertDialog.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putBoolean("IsNethunterNotified", true); editor.apply(); isNethunterNotified = sharedPreferences.getBoolean("IsNethunterNotified", false); dialog.dismiss(); } }); alertDialog.show(); textView.setText(R.string.nethunter_warning_content); }
Example #9
Source File: VMEditView.java From VMLibrary with Apache License 2.0 | 6 votes |
/** * 初始化方法,获取属性等操作 */ private void init(Context context, AttributeSet attrs) { LayoutInflater.from(context).inflate(R.layout.vm_widget_edit, this); mInputView = findViewById(R.id.vm_edit_input_view); mClearIcon = findViewById(R.id.vm_edit_clear_icon); mEyeIcon = findViewById(R.id.vm_edit_eye_icon); // 定义默认值 mTextColor = VMColor.byRes(R.color.vm_black_87); mTextSize = (int) VMDimen.sp2px(14); mHint = ""; mLimit = ""; mMode = Mode.TEXT; mEnableClear = true; mEnableEye = false; mClearRes = R.drawable.vm_ic_close; mEyeRes = R.drawable.vm_ic_eye_off; // 获取控件的属性值 handleAttrs(context, attrs); initEditView(); }
Example #10
Source File: RecipientAlternatesAdapter.java From ChipsLibrary with Apache License 2.0 | 6 votes |
public RecipientAlternatesAdapter(final Context context,final Cursor c,final long currentId,final int queryMode,final OnCheckedItemChangedListener listener) { super(context,c,0); mLayoutInflater=LayoutInflater.from(context); mCurrentId=currentId; mCheckedItemChangedListener=listener; if(queryMode==QUERY_TYPE_EMAIL) mQuery=Queries.EMAIL; else if(queryMode==QUERY_TYPE_PHONE) mQuery=Queries.PHONE; else { mQuery=Queries.EMAIL; Log.e(TAG,"Unsupported query type: "+queryMode); } }
Example #11
Source File: BookmarkAdapter.java From zxingfragmentlib with Apache License 2.0 | 6 votes |
@Override public View getView(int index, View view, ViewGroup viewGroup) { View layout; if (view instanceof LinearLayout) { layout = view; } else { LayoutInflater factory = LayoutInflater.from(context); layout = factory.inflate(R.layout.bookmark_picker_list_item, viewGroup, false); } if (!cursor.isClosed()) { cursor.moveToPosition(index); CharSequence title = cursor.getString(BookmarkPickerActivity.TITLE_COLUMN); ((TextView) layout.findViewById(R.id.bookmark_title)).setText(title); CharSequence url = cursor.getString(BookmarkPickerActivity.URL_COLUMN); ((TextView) layout.findViewById(R.id.bookmark_url)).setText(url); } // Otherwise... just don't update as the object is shutting down return layout; }
Example #12
Source File: SettingsAdapter.java From prebid-mobile-android with Apache License 2.0 | 6 votes |
@NonNull @Override public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { switch (viewType) { case VIEW_TYPE_GENERAL_SETTINGS: return new GeneralSettingsViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.view_general_settings, parent, false)); case VIEW_TYPE_AD_SERVER_SETTINGS: return new AdServerSettingsViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.view_ad_server_settings, parent, false)); case VIEW_TYPE_PREBID_SERVER_SETTINGS: return new PrebidServerSettingsViewholder(LayoutInflater.from(parent.getContext()).inflate(R.layout.view_prebid_server_settings, parent, false)); case VIEW_TYPE_SUBMIT: return new SubmitViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.view_submit, parent, false)); default: return new DividerViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.view_divider, parent, false)); } }
Example #13
Source File: PlaceHolderHolder.java From AndroidTreeView with Apache License 2.0 | 6 votes |
@Override public View createNodeView(TreeNode node, PlaceItem value) { final LayoutInflater inflater = LayoutInflater.from(context); final View view = inflater.inflate(R.layout.layout_place_node, null, false); TextView placeName = (TextView) view.findViewById(R.id.place_name); placeName.setText(value.name); Random r = new Random(); boolean like = r.nextBoolean(); PrintView likeView = (PrintView) view.findViewById(R.id.like); likeView.setIconText(context.getString(like ? R.string.ic_thumbs_up : R.string.ic_thumbs_down)); return view; }
Example #14
Source File: MyCollectFragment.java From KJFrameForAndroid with Apache License 2.0 | 5 votes |
@Override protected View inflaterView(LayoutInflater inflater, ViewGroup container, Bundle bundle) { View root = View.inflate(outsideAty, R.layout.frag_pull_refresh_listview, null); return root; }
Example #15
Source File: RecyclerAdapterBase.java From RecyclerAdapterBase with Apache License 2.0 | 5 votes |
@Override final public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { ViewHolder vh; if (recyclerAdapterHelper.isHeaderType(viewType)) { vh = onCreateHeaderViewHolder(LayoutInflater.from(parent.getContext()), parent); vh.setIsRecyclable(false); } else if (recyclerAdapterHelper.isLoadMoreType(viewType)) { vh = onCreateLoadMoreViewHolder(LayoutInflater.from(parent.getContext()), parent); } else if (recyclerAdapterHelper.isFooterType(viewType)) { vh = onCreateFooterViewHolder(LayoutInflater.from(parent.getContext()), parent); } else { vh = onCreateItemViewHolder(LayoutInflater.from(parent.getContext()), parent, viewType); } return vh; }
Example #16
Source File: MyListAdapter.java From realm-android-adapters with Apache License 2.0 | 5 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; if (convertView == null) { convertView = LayoutInflater.from(parent.getContext()) .inflate(R.layout.row, parent, false); viewHolder = new ViewHolder(); viewHolder.countText = (TextView) convertView.findViewById(R.id.textview); viewHolder.deleteCheckBox = (CheckBox) convertView.findViewById(R.id.checkBox); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } if (adapterData != null) { final Item item = adapterData.get(position); viewHolder.countText.setText(item.getCountString()); if (inDeletionMode) { viewHolder.deleteCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { countersToDelete.add(item.getId()); } }); } else { viewHolder.deleteCheckBox.setOnCheckedChangeListener(null); } viewHolder.deleteCheckBox.setChecked(countersToDelete.contains(item.getId())); viewHolder.deleteCheckBox.setVisibility(inDeletionMode ? View.VISIBLE : View.GONE); } return convertView; }
Example #17
Source File: MainActivity.java From ui with Apache License 2.0 | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_planet, container, false); int i = getArguments().getInt(ARG_PLANET_NUMBER); String planet = getResources().getStringArray(R.array.planets_array)[i]; int imageId = getResources().getIdentifier(planet.toLowerCase(Locale.getDefault()), "drawable", getActivity().getPackageName()); ((ImageView) rootView.findViewById(R.id.image)).setImageResource(imageId); getActivity().setTitle(planet); return rootView; }
Example #18
Source File: ColorSelectFragment.java From FaceT with Mozilla Public License 2.0 | 5 votes |
public Dialog onCreateDialog(Bundle savedInstanceState) { final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); // Get the layout inflater LayoutInflater inflater = getActivity().getLayoutInflater(); View rootView = inflater.inflate(R.layout.color_select_fragment_layout, null); LinearLayoutManager llm = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false); //RECYCER color_select_recyclerview = (RecyclerView) rootView.findViewById(R.id.color_select_recyclerview); color_select_recyclerview.setLayoutManager(llm); data = (ArrayList<String>) getArguments().getSerializable("selectedColor"); adapter = new SelectColorRecyclerAdapter(getActivity(),data); Log.d(TAG + " data ", data.toString()); color_select_recyclerview.setAdapter(new SelectColorRecyclerAdapter(this.getActivity(), data)); ItemTouchHelper.Callback callback = new MyItemTouchHelperCallback(this);// create MyItemTouchHelperCallback ItemTouchHelper touchHelper = new ItemTouchHelper(callback); // Create ItemTouchHelper and pass with parameter the MyItemTouchHelperCallback touchHelper.attachToRecyclerView(color_select_recyclerview); // Attach ItemTouchHelper to RecyclerView builder.setTitle("Swap Color position"); builder.setView(rootView).setPositiveButton("Ok",new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { passData(data); dialog.dismiss(); } }); builder.setView(rootView).setNegativeButton("Cancel", null); return builder.create(); }
Example #19
Source File: SavedCollectionFragment.java From Expert-Android-Programming with MIT License | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_collection, container, false); recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView); return view; }
Example #20
Source File: AboutDialogFragment.java From SecondScreen with Apache License 2.0 | 5 votes |
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { // Use the Builder class for convenient dialog construction AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); // Get the layout inflater final LayoutInflater inflater = getActivity().getLayoutInflater(); // Inflate and set the layout for the dialog // Pass null as the parent view because its going in the dialog layout final View view = inflater.inflate(R.layout.fragment_dialogs, null); builder.setView(view) .setTitle(R.string.dialog_about_title) .setPositiveButton(R.string.action_close, (dialog, id) -> {}); if(!BuildConfig.DEBUG) { builder.setNegativeButton(R.string.check_for_update, (dialog, id) -> listener.onAboutDialogNegativeClick(this)); } Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("America/Denver")); calendar.setTimeInMillis(BuildConfig.TIMESTAMP); int year = calendar.get(Calendar.YEAR); textView = view.findViewById(R.id.dialogMessage); textView.setText(getString(R.string.dialog_about_message, year)); textView.setMovementMethod(LinkMovementMethod.getInstance()); checkbox = view.findViewById(R.id.checkBoxLayout); checkbox.setVisibility(View.GONE); // Create the AlertDialog object and return it return builder.create(); }
Example #21
Source File: FeatureLinearHolder.java From MusicPlayer with GNU General Public License v3.0 | 5 votes |
public FeatureLinearHolder(Context context, ViewGroup linearLayout) { this.mContext = context; View v = LayoutInflater.from(context).inflate(R.layout.feature_tab_body,linearLayout,false); ButterKnife.bind(this,v); mPlayListFrame.setVisibility(View.GONE); linearLayout.removeAllViews(); linearLayout.addView(v); mPlaylistMiniAdapter = new PlaylistMiniAdapter(mPlayListFrame); mSongMiniAdapter = new SongMiniAdapter(mSongFrame); }
Example #22
Source File: BaseAty.java From Huochexing12306 with Apache License 2.0 | 5 votes |
/** * 初始化界面时调用 * @param containerId * @param contentViewId */ public void initContainerViews(int containerId, int contentViewId, int pullToRefreshViewId){ if (!mDisableLoadingView){ mFooterLoadingView = LayoutInflater.from(this).inflate(R.layout.footer_loading_view, null); mFooterLoadingView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); mContainer = (ViewGroup)findViewById(containerId); mContentView = (ViewGroup)findViewById(contentViewId); mPullToRefreshView = (PullToRefreshView)findViewById(pullToRefreshViewId); if (mPullToRefreshView != null){ mPullToRefreshView.setOnHeaderRefreshListener(this); mPullToRefreshView.setOnFooterRefreshListener(this); } showLoadingView(); } }
Example #23
Source File: DebugView.java From debugdrawer with Apache License 2.0 | 5 votes |
public DebugView(Context context, AttributeSet attrs) { super(context, attrs); // Inflate all of the controls and inject them. LayoutInflater.from(context).inflate(R.layout.debug_view_content, this); contextualTitleView = findById(this, R.id.debug_contextual_title); contextualListView = findById(this, R.id.debug_contextual_list); enableLayoutTransitions(contextualListView); ((ImageView) findById(this, R.id.debug_icon)).setImageResource(context.getApplicationInfo().icon); }
Example #24
Source File: OrgUnitRow.java From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License | 5 votes |
public OrgUnitRow(FragmentManager fm, LayoutInflater layoutInflater, FlowableProcessor<RowAction> processor, boolean isBgTransparent) { this.inflater = layoutInflater; this.processor = processor; this.isBgTransparent = isBgTransparent; this.fm = fm; this.renderType = null; this.isSearchMode = true; this.currentSelection = null; }
Example #25
Source File: NotificationBoard.java From Android-Notification with Apache License 2.0 | 5 votes |
private void initialize() { mContext = getContext(); mInflater = LayoutInflater.from(mContext); mCenter = NotificationDelegater.getInstance().center(); mCenter.addListener(this); mGestureDetector = new GestureDetectorCompat(mContext, this); mH = new H(this); mContentView = new ContentView(mContext); addView(mContentView, new FrameLayout.LayoutParams( mContentView.mWidth, mContentView.mHeight, Gravity.CENTER | Gravity.TOP)); }
Example #26
Source File: SlsPreferenceFragment.java From Jockey with Apache License 2.0 | 5 votes |
@Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { binding = DataBindingUtil.inflate(inflater, R.layout.fragment_sls_preference, container, false); viewModel = new SlsPreferenceViewModel(getContext(), preferenceStore, playerController); binding.setViewModel(viewModel); binding.readmeMessage.setMovementMethod(new LinkMovementMethod()); return binding.getRoot(); }
Example #27
Source File: ExpandableListMoodleSectionAdapter.java From ETSMobile-Android2 with Apache License 2.0 | 5 votes |
@Override public View getGroupView(int groupPosition, boolean isExpanded,View convertView, ViewGroup parent) { MoodleCourseDetailsFragment.HeaderText header = (MoodleCourseDetailsFragment.HeaderText) getGroup(groupPosition); if (convertView == null) { LayoutInflater infalInflater = (LayoutInflater) this._context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = infalInflater.inflate(R.layout.list_group, null); } TextView lblListHeader = (TextView) convertView.findViewById(R.id.lblListHeader); lblListHeader.setTypeface(null, Typeface.BOLD); lblListHeader.setText(header.getHeaderName()); return convertView; }
Example #28
Source File: FlatPlayerFragment.java From Phonograph with GNU General Public License v3.0 | 5 votes |
@Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (Util.isLandscape(getResources())) { impl = new LandscapeImpl(this); } else { impl = new PortraitImpl(this); } View view = inflater.inflate(R.layout.fragment_flat_player, container, false); unbinder = ButterKnife.bind(this, view); return view; }
Example #29
Source File: CallsRecyclerViewAdapter.java From BaldPhone with Apache License 2.0 | 5 votes |
public CallsRecyclerViewAdapter(List<Call> callList, BaldActivity activity) { this.callList = callList; this.activity = activity; this.inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); final TypedValue typedValue = new TypedValue(); final Resources.Theme theme = activity.getTheme(); theme.resolveAttribute(R.attr.bald_decoration_on_button, typedValue, true); textColorOnRegular = typedValue.data; theme.resolveAttribute(R.attr.bald_background, typedValue, true); this.letterContactBackground = new ColorDrawable(typedValue.data); this.randomColorMaker = new RandomColorMaker(typedValue.data); this.privateFace = activity.getDrawable(R.drawable.private_face_in_recent_calls); this.face = activity.getDrawable(R.drawable.face_in_recent_calls); }
Example #30
Source File: BaseDialog.java From Collection-Android with MIT License | 5 votes |
public void setContentView(int layoutRes){ if(layoutRes!=0){ this.mainView= LayoutInflater.from(context).inflate(layoutRes,null); }else{ this.mainView=null; } create(); }