android.view.ViewGroup Java Examples
The following examples show how to use
android.view.ViewGroup.
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: AutofillLocalCardEditor.java From AndroidChromium with Apache License 2.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = super.onCreateView(inflater, container, savedInstanceState); mNameLabel = (CompatibilityTextInputLayout) v.findViewById(R.id.credit_card_name_label); mNameText = (EditText) v.findViewById(R.id.credit_card_name_edit); mNumberLabel = (CompatibilityTextInputLayout) v.findViewById(R.id.credit_card_number_label); mNumberText = (EditText) v.findViewById(R.id.credit_card_number_edit); // Set text watcher to format credit card number mNumberText.addTextChangedListener(new CreditCardNumberFormattingTextWatcher()); mExpirationMonth = (Spinner) v.findViewById(R.id.autofill_credit_card_editor_month_spinner); mExpirationYear = (Spinner) v.findViewById(R.id.autofill_credit_card_editor_year_spinner); addSpinnerAdapters(); addCardDataToEditFields(); initializeButtons(v); return v; }
Example #2
Source File: ForumsAdapter.java From Ruisi with Apache License 2.0 | 6 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { CircleImageView imageView; // 声明ImageView的对象 if (convertView == null) { imageView = new CircleImageView(context); AbsListView.LayoutParams p = new AbsListView.LayoutParams(itemWidth, itemWidth); imageView.setLayoutParams(p); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); } else { imageView = (CircleImageView) convertView; } Picasso.get() .load(ds.get(position).imgSrc) .placeholder(R.drawable.image_placeholder) .into(imageView); return imageView; }
Example #3
Source File: RecipeActivity.java From io2015-codelabs with Apache License 2.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.ingredients_fragment, container, false); this.recipe = ((RecipeActivity)getActivity()).recipe; TableLayout table = (TableLayout)rootView.findViewById(R.id.ingredientsTable); for (Recipe.Ingredient ingredient : recipe.getIngredients()) { TableRow row = (TableRow)inflater.inflate(R.layout.ingredients_row, null); ((TextView)row.findViewById(R.id.attrib_name)).setText(ingredient.getAmount()); ((TextView)row.findViewById(R.id.attrib_value)).setText(ingredient.getDescription()); table.addView(row); } return rootView; }
Example #4
Source File: BookcaseDragAdapter.java From MissZzzReader with Apache License 2.0 | 6 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; if (convertView == null) { viewHolder = new ViewHolder(); convertView = LayoutInflater.from(mContext).inflate(mResourceId, null); viewHolder.ivBookImg = convertView.findViewById(R.id.iv_book_img); viewHolder.tvBookName = convertView.findViewById(R.id.tv_book_name); viewHolder.tvNoReadNum = convertView.findViewById(R.id.tv_no_read_num); viewHolder.ivDelete = convertView.findViewById(R.id.iv_delete); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } initView(position, viewHolder); return convertView; }
Example #5
Source File: AlbumFragment.java From Muzesto with GNU General Public License v3.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate( R.layout.fragment_recyclerview, container, false); recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview); fastScroller = (FastScroller) rootView.findViewById(R.id.fastscroller); FloatingActionButton fab = (FloatingActionButton) rootView.findViewById(R.id.fab); fab.hide(); ImageView backdrop = (ImageView) rootView.findViewById(R.id.white_backdrop); backdrop.setVisibility(View.VISIBLE); setLayoutManager(); if (getActivity() != null) new loadAlbums().execute(""); return rootView; }
Example #6
Source File: ExpandableListAdapter.java From osmdroid with Apache License 2.0 | 6 votes |
@Override public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { String headerTitle = (String) 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 = convertView .findViewById(R.id.lblListHeader); lblListHeader.setTypeface(null, Typeface.BOLD); lblListHeader.setText(headerTitle); return convertView; }
Example #7
Source File: ThemeableActivity.java From Camera-Roll-Android-App with Apache License 2.0 | 6 votes |
private static ArrayList<View> findViewsWithTag(String TAG, ViewGroup rootView, ArrayList<View> views) { Object tag = rootView.getTag(); if (tag != null && tag.equals(TAG)) { views.add(rootView); } for (int i = 0; i < rootView.getChildCount(); i++) { View v = rootView.getChildAt(i); tag = v.getTag(); if (tag != null && tag.equals(TAG)) { views.add(v); } if (v instanceof ViewGroup) { findViewsWithTag(TAG, (ViewGroup) v, views); } } return views; }
Example #8
Source File: Delegate.java From MousePaint with MIT License | 6 votes |
/** * 显示模糊背景 */ protected void showShowdown() { ViewHelper.setTranslationY(mRootView, 0); mEffect.effect(mParentVG,mBg); ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); if(mBg.getParent()!= null){ mParentVG.removeView(mBg); } mParentVG.addView(mBg, lp); ViewHelper.setAlpha(mBg, 0); ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(mBg, "alpha", 0, 1); objectAnimator.setDuration(400); objectAnimator.start(); }
Example #9
Source File: FloatingToolbar.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
private static void updateMenuItemButton(View menuItemButton, MenuItem menuItem, int iconTextSpacing) { ViewGroup viewGroup = (ViewGroup) menuItemButton; final TextView buttonText = (TextView) viewGroup.getChildAt(0); buttonText.setEllipsize(null); if (TextUtils.isEmpty(menuItem.getTitle())) { buttonText.setVisibility(View.GONE); } else { buttonText.setVisibility(View.VISIBLE); buttonText.setText(menuItem.getTitle()); } buttonText.setPaddingRelative(0, 0, 0, 0); /*final CharSequence contentDescription = menuItem.getContentDescription(); TODO if (TextUtils.isEmpty(contentDescription)) { menuItemButton.setContentDescription(menuItem.getTitle()); } else { menuItemButton.setContentDescription(contentDescription); }*/ }
Example #10
Source File: StatusBarUtil.java From ByWebView with Apache License 2.0 | 6 votes |
/** * 设置状态栏颜色 * * @param activity 需要设置的activity * @param color 状态栏颜色值 * @param statusBarAlpha 状态栏透明度 */ public static void setColor(Activity activity, @ColorInt int color, int statusBarAlpha) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); activity.getWindow().setStatusBarColor(calculateStatusColor(color, statusBarAlpha)); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView(); int count = decorView.getChildCount(); if (count > 0 && decorView.getChildAt(count - 1) instanceof StatusBarView) { decorView.getChildAt(count - 1).setBackgroundColor(calculateStatusColor(color, statusBarAlpha)); } else { StatusBarView statusView = createStatusBarView(activity, color, statusBarAlpha); decorView.addView(statusView); } setRootView(activity); } }
Example #11
Source File: FragmentShowImage.java From iGap-Android with GNU Affero General Public License v3.0 | 6 votes |
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { realmShowImage = Realm.getDefaultInstance(); //View view = inflater.inflate(R.layout.activity_show_image, container, false); //exitFragmentTransition = FragmentTransition.with(this).duration(200).interpolator(new LinearOutSlowInInterpolator()).to(view.findViewById(R.id.asi_view_pager)).start(savedInstanceState); // //exitFragmentTransition.exitListener(new AnimatorListenerAdapter() { // @Override // public void onAnimationStart(Animator animation) { // Log.d("FFFFFFF", "onAnimationStart: "); // } // // @Override // public void onAnimationEnd(Animator animation) { // Log.d("FFFFFFF", "onAnimationEnd: "); // } //}).interpolator(new FastOutSlowInInterpolator()); //exitFragmentTransition.startExitListening(view.findViewById(R.id.rooShowImage)); return inflater.inflate(R.layout.activity_show_image, container, false); }
Example #12
Source File: ViewUtil.java From smart-farmer-android with Apache License 2.0 | 6 votes |
public static void resetSize(View view, int width, int height){ if (view == null) { return; } ViewGroup.LayoutParams params = view.getLayoutParams(); if (params == null){ params = new ViewGroup.LayoutParams(width, height); view.setLayoutParams(params); return; } boolean hasChanged = false; if (params.width != width){ params.width = width; hasChanged = true; } if (params.height != height){ params.height = height; hasChanged = true; } if (hasChanged) { view.requestLayout(); } }
Example #13
Source File: PageFragment.java From funcodetuts with Apache License 2.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_page, container, false); RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.main_recycler); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity().getBaseContext()); recyclerView.setLayoutManager(linearLayoutManager); recyclerView.setHasFixedSize(true); List<String> list = new ArrayList<>(); for (int i = 0; i < 10; i++) { list.add("Item " + i); } SimpleRecyclerAdapter adapter = new SimpleRecyclerAdapter(list); recyclerView.setAdapter(adapter); adapter.setOnItemTapListener(mListItemClickListener); return view; }
Example #14
Source File: ReportAdapter.java From privacy-friendly-pedometer with GNU General Public License v3.0 | 6 votes |
@Override public ReportAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View v; ViewHolder vh; switch (viewType) { case TYPE_CHART: v = LayoutInflater.from(parent.getContext()) .inflate(R.layout.card_activity_bar_chart, parent, false); vh = new CombinedChartViewHolder(v); break; case TYPE_DAY_CHART: v = LayoutInflater.from(parent.getContext()) .inflate(R.layout.card_activity_chart, parent, false); vh = new ChartViewHolder(v); break; case TYPE_SUMMARY: default: v = LayoutInflater.from(parent.getContext()) .inflate(R.layout.card_activity_summary, parent, false); vh = new SummaryViewHolder(v); break; } return vh; }
Example #15
Source File: ScrollFlag.java From smooth-app-bar-layout with Apache License 2.0 | 6 votes |
public ScrollFlag(AppBarLayout layout) { if (layout != null) { int i = 0; for (int z = layout.getChildCount(); i < z; ++i) { View child = layout.getChildAt(i); ViewGroup.LayoutParams layoutParams = child.getLayoutParams(); if (layoutParams instanceof AppBarLayout.LayoutParams) { AppBarLayout.LayoutParams childLp = (AppBarLayout.LayoutParams) layoutParams; int flags = childLp.getScrollFlags(); if ((flags & AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL) != 0) { vView = child; mFlags = flags; break; } } } } }
Example #16
Source File: MySimplePerformanceArrayAdapter.java From codeexamples-android with Eclipse Public License 1.0 | 6 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { View rowView = convertView; if (rowView == null) { LayoutInflater inflater = context.getLayoutInflater(); rowView = inflater.inflate(R.layout.rowlayout, null); } TextView textView = (TextView) rowView.findViewById(R.id.label); ImageView imageView = (ImageView) rowView.findViewById(R.id.icon); String s = names[position]; textView.setText(s); if (s.startsWith("Windows7") || s.startsWith("iPhone") || s.startsWith("Solaris")) { imageView.setImageResource(R.drawable.no); } else { imageView.setImageResource(R.drawable.ok); } return rowView; }
Example #17
Source File: VideoFragment.java From MediaChooser with Apache License 2.0 | 6 votes |
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (mView == null) { mView = inflater.inflate(R.layout.view_grid_layout_media_chooser, container, false); getActivity().getWindow().setBackgroundDrawable(null); mVideoGridView = (GridView) mView.findViewById(R.id.gridViewFromMediaChooser); if (getArguments() != null) { initVideos(getArguments().getString("name")); } else { initVideos(); } } else { if (mView.getParent() != null) { ((ViewGroup) mView.getParent()).removeView(mView); } if (mVideoAdapter == null || mVideoAdapter.getCount() == 0) { Toast.makeText(getActivity(), getActivity().getString(R.string.no_media_file_available), Toast.LENGTH_SHORT).show(); } } return mView; }
Example #18
Source File: BlogDateAdapter.java From LoveTalkClient with Apache License 2.0 | 6 votes |
TextView getTextView() { //设置TextView的样式 AbsListView.LayoutParams lp = new AbsListView.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, 64); TextView textView = new TextView( mContext); textView.setLayoutParams(lp); textView.setGravity(Gravity.CENTER_VERTICAL); //设置TextView的Padding值 textView.setPadding(16, -10, 0, 32); //设置TextView的字体大小 textView.setTextSize(14); //设置TextView的字体颜色 textView.setTextColor(Color.WHITE); //设置字体加粗 TextPaint txt = textView.getPaint(); txt.setFakeBoldText(true); return textView; }
Example #19
Source File: FlipperViewSampleFragment.java From oneHookLibraryAndroid with Apache License 2.0 | 5 votes |
@Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_sample_flipper_view, container, false); }
Example #20
Source File: ViewsPagerAdapter.java From ProjectX with Apache License 2.0 | 5 votes |
@NonNull @Override public Object instantiateItem(@NonNull ViewGroup container, int position) { final ViewHolder holder = mItems.get(position); holder.mPosition = position; holder.mNeedRebind = false; holder.mPositionChanged = false; holder.mRemoved = false; final View view = holder.itemView; onBindView(view, position); container.addView(view); mItemsInLayout.add(holder); return holder; }
Example #21
Source File: YoutubeAdapter.java From search-youtube with Apache License 2.0 | 5 votes |
@Override public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // create a new view View itemView = LayoutInflater.from(parent.getContext()) .inflate(R.layout.video_item, parent, false); return new MyViewHolder(itemView); }
Example #22
Source File: X8AiLineHistoryAdapter.java From FimiX8-RE with MIT License | 5 votes |
public View initView(ViewGroup parent) { View view = LayoutInflater.from(X8AiLineHistoryAdapter.this.context).inflate(R.layout.x8_ai_line_history_item_layout, parent, false); this.mTvItemTitle1 = (TextView) view.findViewById(R.id.tvItme1); this.mTvItemTitle2 = (TextView) view.findViewById(R.id.tvItme2); this.mTvItemTitle3 = (TextView) view.findViewById(R.id.tvItme3); return view; }
Example #23
Source File: TextMessagePreference.java From delion with Apache License 2.0 | 5 votes |
@Override protected View onCreateView(ViewGroup parent) { View view = super.onCreateView(parent); TextView textView = (TextView) view.findViewById(android.R.id.title); textView.setSingleLine(false); textView.setMaxLines(Integer.MAX_VALUE); textView.setMovementMethod(LinkMovementMethod.getInstance()); return view; }
Example #24
Source File: ChannelSetupStylist.java From androidtv-sample-inputs with Apache License 2.0 | 5 votes |
@Override public View onCreateView( LayoutInflater layoutInflater, ViewGroup viewGroup, Guidance guidance) { View view = super.onCreateView(layoutInflater, viewGroup, guidance); mProgressBar = (ProgressBar) view.findViewById(R.id.tif_tune_progress); ListView channelList = (ListView) view.findViewById(R.id.tif_channel_list); mAdapter = new ChannelAdapter(); channelList.setAdapter(mAdapter); channelList.setOnItemClickListener(null); return view; }
Example #25
Source File: AppsInBundleAdapter.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
@Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { switch (viewType) { case REWARD_APP: return new RewardAppInBundleViewHolder(LayoutInflater.from(parent.getContext()) .inflate(REWARD_APP, parent, false), appClickedEvents); case APP: return new AppInBundleViewHolder(LayoutInflater.from(parent.getContext()) .inflate(APP, parent, false), appClickedEvents, oneDecimalFormatter); default: throw new IllegalArgumentException("Wrong type of App"); } }
Example #26
Source File: WelcomeViewBinder.java From Synapse with Apache License 2.0 | 5 votes |
@Override protected void onBindViewHolder(@NonNull WelcomeHolder holder, @NonNull WelcomeItem dataSet) { final Resources resources = holder.download.getResources(); TransitionManager.beginDelayedTransition((ViewGroup) holder.itemView); switch (dataSet.state()) { case WelcomeItem.READY: holder.download.setText(R.string.data_ready); holder.download.setTextColor(ResourcesCompat.getColor(resources, R.color.data_ready_text, null)); holder.download.setClickable(false); holder.progress.setVisibility(View.GONE); break; case WelcomeItem.WAITING: holder.download.setTextColor(ResourcesCompat.getColor(resources, R.color.data_waiting_text, null)); holder.download.setText(R.string.data_waiting); holder.download.setClickable(true); holder.progress.setVisibility(View.VISIBLE); break; case WelcomeItem.UNREADY: holder.download.setTextColor(ResourcesCompat.getColor(resources, R.color.data_unready_text, null)); holder.download.setText(R.string.data_unready); holder.download.setClickable(true); holder.progress.setVisibility(View.GONE); break; } }
Example #27
Source File: DrawerLayout.java From Carbon with Apache License 2.0 | 5 votes |
public void setHeight(int height) { ViewGroup.LayoutParams layoutParams = getLayoutParams(); if (layoutParams == null) { setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, height)); } else { layoutParams.height = height; setLayoutParams(layoutParams); } }
Example #28
Source File: Adapter.java From timecat with Apache License 2.0 | 5 votes |
@Override public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { switch (viewType) { case VIEW_TYPE_EMPTY: return new EmptyViewHolder(parent); case VIEW_TYPE_DATA: return new AppInfoViewHolder(parent); case VIEW_TYE_LOAD: return new LoadingViewHolder(parent); } return null; }
Example #29
Source File: BaseFragment.java From ETSMobile-Android2 with Apache License 2.0 | 5 votes |
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { loadingView = (LoadingView) container.findViewById(R.id.loadingView); if (loadingView != null) { this.loadingView.setVisibility(View.GONE); } return container; }
Example #30
Source File: PopWindowActivity.java From LLApp with Apache License 2.0 | 5 votes |
private void showPopListView(){ View contentView = LayoutInflater.from(this).inflate(R.layout.pop_list,null); //处理popWindow 显示内容 handleListView(contentView); //创建并显示popWindow mListPopWindow= new CustomPopWindow.PopupWindowBuilder(this) .setView(contentView) .size(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT)//显示大小 .create() .showAsDropDown(mButton4,0,20); }