Java Code Examples for android.view.LayoutInflater#inflate()
The following examples show how to use
android.view.LayoutInflater#inflate() .
These examples are extracted from open source projects.
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 Project: PKUCourses File: SpareClassroomsFragment.java License: GNU General Public License v3.0 | 6 votes |
@Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment LinearLayout linearLayout = (LinearLayout) inflater.inflate(R.layout.fragment_spare_classrooms, container, false); // 查找xml文件中的对象并保存进Java变量 mSpareClassroomsSwipeContainer = linearLayout.findViewById(R.id.spare_classrooms_swipe_container); mWebView = linearLayout.findViewById(R.id.spare_classrooms_web_view); mSpareClassroomsSwipeContainer.setOnRefreshListener(this); mSpareClassroomsSwipeContainer.setColorSchemeColors(getResources().getColor(R.color.colorPrimary), getResources().getColor(R.color.colorAccent)); // 显示Loading的小动画,并在后台读取课程列表 showLoading(true); mLoadingTask = new SpareClassroomsLoadingTask(); mLoadingTask.execute((Void) null); return linearLayout; }
Example 2
Source Project: android-sensor-example File: NavigationDrawerFragment.java License: Apache License 2.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mDrawerListView = (ListView) inflater.inflate( R.layout.fragment_navigation_drawer, container, false); mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { selectItem(position); } }); // populate the fragments available for navigation here mDrawerListView.setAdapter(new ArrayAdapter<Fragment>( getActionBar().getThemedContext(), android.R.layout.simple_list_item_1, android.R.id.text1, new Fragment[]{ new WelcomeFragment(), new ListSensorFragment(), new SensorDataFragment(), new ScheduleServiceFragment() })); mDrawerListView.setItemChecked(mCurrentSelectedPosition, true); return mDrawerListView; }
Example 3
Source Project: osmdroid File: SampleAnimateToWithOrientation.java License: Apache License 2.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View root = inflater.inflate(R.layout.sample_cachemgr, container,false); mMapView = new MapView(getActivity()); ((LinearLayout) root.findViewById(R.id.mapview)).addView(mMapView); btnCache = root.findViewById(R.id.btnCache); btnCache.setOnClickListener(this); next(); /* final RotationGestureOverlay rotationGestureOverlay = new RotationGestureOverlay(mMapView); rotationGestureOverlay.setEnabled(true); mMapView.getOverlays().add(rotationGestureOverlay); */ return root; }
Example 4
Source Project: bither-android File: OptionHotFragment.java License: Apache License 2.0 | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_hot_option, container, false); initView(view); return view; }
Example 5
Source Project: Toutiao File: VideoTabLayout.java License: Apache License 2.0 | 5 votes |
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_video_tab, container, false); initView(view); initData(); return view; }
Example 6
Source Project: youqu_master File: SlideFragment.java License: Apache License 2.0 | 5 votes |
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_slide, container, false); titleTextView = (TextView) view.findViewById(R.id.txt_title_slide); descriptionTextView = (TextView) view.findViewById(R.id.txt_description_slide); imageView = (ImageView) view.findViewById(R.id.image_slide); initializeView(); return view; }
Example 7
Source Project: Wrox-ProfessionalAndroid-4E File: EarthquakeListFragment.java License: Apache License 2.0 | 5 votes |
@Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_earthquake_list, container, false); mRecyclerView = view.findViewById(R.id.list); mSwipeToRefreshView = view.findViewById(R.id.swiperefresh); return view; }
Example 8
Source Project: adamant-android File: AdamantTransferMessageViewHolder.java License: GNU General Public License v3.0 | 5 votes |
public AdamantTransferMessageViewHolder(Router router, Context context, View v, AdamantMarkdownProcessor adamantAddressProcessor, Avatar avatar) { super(context, v, adamantAddressProcessor, avatar); this.router = router; LayoutInflater inflater = LayoutInflater.from(context); contentView = inflater.inflate(R.layout.list_subitem_adamant_transfer_message, contentBlock, false); contentBlock.addView(contentView); amountView = contentView.findViewById(R.id.list_item_message_amount); }
Example 9
Source Project: Capstone-Project File: UsersFragment.java License: MIT License | 5 votes |
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_users, container, false); ButterKnife.bind(this, view); return view; }
Example 10
Source Project: Building-Professional-Android-Applications File: StockPortfolioListFragment.java License: MIT License | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.portfolio_fragment_stock_list, container, false); unbinder = ButterKnife.bind(this, view); mRecyclerView.setHasFixedSize(true); mRecyclerView.setLayoutManager( new LinearLayoutManager(this.getContext()) ); mRecyclerView.setAdapter(mAdapter); return view; }
Example 11
Source Project: Interessant File: VideoViewBinder.java License: Apache License 2.0 | 4 votes |
@NonNull @Override protected Holder onCreateViewHolder( @NonNull LayoutInflater inflater, @NonNull ViewGroup parent) { View view = inflater.inflate(R.layout.item_movie, parent, false); return new Holder(view); }
Example 12
Source Project: titanium-imagepicker File: ImagePickerActivity.java License: Apache License 2.0 | 4 votes |
@Override public PhotoHolder onCreateViewHolder(ViewGroup v, int type) { LayoutInflater inflater = LayoutInflater.from(TiApplication.getAppRootOrCurrentActivity()); View view = inflater.inflate(main_image_view, v, false); return new PhotoHolder(view); }
Example 13
Source Project: android-openslmediaplayer File: PlayerControlFragment.java License: Apache License 2.0 | 4 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_player_control, container, false); return rootView; }
Example 14
Source Project: commcare-android File: SelectOneAutoAdvanceWidget.java License: Apache License 2.0 | 4 votes |
public SelectOneAutoAdvanceWidget(Context context, FormEntryPrompt prompt) { super(context, prompt); LayoutInflater inflater = LayoutInflater.from(getContext()); mItems = getSelectChoices(); buttons = new Vector<>(); listener = (AdvanceToNextListener)context; String s = null; if (prompt.getAnswerValue() != null) { s = ((Selection)prompt.getAnswerValue().getValue()).getValue(); } //Is this safe enough from collisions? buttonIdBase = Math.abs(prompt.getIndex().hashCode()); if (mItems != null) { for (int i = 0; i < mItems.size(); i++) { RelativeLayout thisParentLayout = (RelativeLayout)inflater.inflate(R.layout.quick_select_layout, null); final LinearLayout questionLayout = (LinearLayout)thisParentLayout.getChildAt(0); ImageView rightArrow = (ImageView)thisParentLayout.getChildAt(1); final RadioButton r = new RadioButton(getContext()); r.setOnCheckedChangeListener(this); String markdownText = prompt.getSelectItemMarkdownText(mItems.get(i)); if (markdownText != null) { r.setText(forceMarkdown(markdownText)); } else { r.setText(prompt.getSelectChoiceText(mItems.get(i))); } r.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mQuestionFontSize); r.setId(i + buttonIdBase); r.setEnabled(!prompt.isReadOnly()); r.setFocusable(!prompt.isReadOnly()); Drawable image = getResources().getDrawable(R.drawable.icon_auto_advance_arrow); rightArrow.setImageDrawable(image); rightArrow.setOnTouchListener((v, event) -> { r.onTouchEvent(event); return false; }); buttons.add(r); if (mItems.get(i).getValue().equals(s)) { r.setChecked(true); } String audioURI = null; audioURI = prompt.getSpecialFormSelectChoiceText(mItems.get(i), FormEntryCaption.TEXT_FORM_AUDIO); String imageURI = null; imageURI = prompt.getSpecialFormSelectChoiceText(mItems.get(i), FormEntryCaption.TEXT_FORM_IMAGE); String videoURI = null; videoURI = prompt.getSpecialFormSelectChoiceText(mItems.get(i), "video"); String bigImageURI = null; bigImageURI = prompt.getSpecialFormSelectChoiceText(mItems.get(i), "big-image"); MediaLayout mediaLayout = MediaLayout.buildAudioImageVisualLayout(getContext(), r, audioURI, imageURI, videoURI, bigImageURI); questionLayout.addView(mediaLayout); // Last, add the dividing line (except for the last element) ImageView divider = new ImageView(getContext()); divider.setBackgroundResource(android.R.drawable.divider_horizontal_bright); if (i != mItems.size() - 1) { mediaLayout.addDivider(divider); } addView(thisParentLayout); } } }
Example 15
Source Project: YImagePicker File: MultiImagePickerFragment.java License: Apache License 2.0 | 4 votes |
@Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { view = inflater.inflate(R.layout.picker_activity_multipick, container, false); return view; }
Example 16
Source Project: TreeView File: TreeAdapter.java License: Apache License 2.0 | 4 votes |
@Override public TreeViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { LayoutInflater inflater = LayoutInflater.from(mContext); View view = inflater.inflate(R.layout.rv_item_tree, parent, false); return new TreeViewHolder(view); }
Example 17
Source Project: Kandroid File: ProjectOverdueTasksFragment.java License: GNU General Public License v3.0 | 4 votes |
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { // Log.d("ProjectsFragment", "onCreateView"); return inflater.inflate(R.layout.fragment_expandable_list, container, false); }
Example 18
Source Project: fritz-examples File: CameraConnectionFragment.java License: MIT License | 4 votes |
@Override public View onCreateView( final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { return inflater.inflate(layout, container, false); }
Example 19
Source Project: minx File: SplashSettingsFragment.java License: MIT License | 4 votes |
@Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_splash_settings, container, false); }
Example 20
Source Project: nono-android File: RecycleBinFragment.java License: GNU General Public License v3.0 | 4 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.recycle_view, container, false); return view; }