List of usage examples for android.widget RelativeLayout findViewById
@Nullable public final <T extends View> T findViewById(@IdRes int id)
From source file:org.mozilla.gecko.DoorHangerPopup.java
private void init() { setBackgroundDrawable(new BitmapDrawable()); setOutsideTouchable(true);/*from ww w.j a v a 2 s . com*/ setWindowLayoutMode(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); LayoutInflater inflater = LayoutInflater.from(mContext); RelativeLayout layout = (RelativeLayout) inflater.inflate(R.layout.doorhangerpopup, null); mContent = (LinearLayout) layout.findViewById(R.id.doorhanger_container); setContentView(layout); mInflated = true; }
From source file:org.ambient.control.home.roomitems.LightObjectStrategy.java
@Override public View onCreateView(Fragment context, Entity entity) { LayoutInflater inflater = (LayoutInflater) context.getActivity() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); RelativeLayout container = (RelativeLayout) inflater.inflate(R.layout.layout_room_item_lightobject_content, null);//from ww w.ja v a 2 s . c om ImageView itemContent = (ImageView) container.findViewById(R.id.imageViewItemIcon); updateIcon(((Switchable) entity).getPowerState(), itemContent); return container; }
From source file:com.fairphone.fplauncher3.applifecycle.AgingAppsListAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { AppInfo info = allApps.get(position); RelativeLayout fullIcon = (RelativeLayout) mInflater.inflate(R.layout.fp_aging_apps_item, parent, false); BubbleTextView icon = (BubbleTextView) fullIcon.findViewById(R.id.application_icon); View pinLabel = fullIcon.findViewById(R.id.label_icon_pinned); View newLabel = fullIcon.findViewById(R.id.label_icon_new); View updatedLabel = fullIcon.findViewById(R.id.label_icon_updated); icon.applyFromApplicationInfo(info); icon.setOnClickListener(mLauncher);//from w w w . j av a 2 s .c o m icon.setOnLongClickListener(mLongClickListener); icon.setOnTouchListener(null); icon.setOnKeyListener(null); icon.setOnFocusChangeListener(null); ApplicationRunInformation appRunInfo = AppDiscoverer.getInstance().getApplicationRunInformation(mContext, info.getComponentName()); if (appRunInfo != null) { if (appRunInfo.isPinnedApp()) { pinLabel.setVisibility(View.VISIBLE); } if (appRunInfo.isUpdatedApp()) { updatedLabel.setVisibility(View.VISIBLE); } else if (appRunInfo.isNewApp()) { newLabel.setVisibility(View.VISIBLE); } } if (isUnusedApp) { Drawable icd = icon.getCompoundDrawables()[1]; // 1 is top if (icd != null) { int alpha = mContext.getResources().getInteger(R.integer.color_alpha_70_percent); icd.setAlpha(alpha); updatedLabel.setAlpha(alpha); newLabel.setAlpha(alpha); } } return fullIcon; }
From source file:com.foxconn.lib.welcome.license.TestFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { RelativeLayout layout = (RelativeLayout) inflater.inflate(R.layout.welcome_content, null); TextView welcome_content_subject_tv, welcome_content_subject_detail_tv; welcome_content_subject_tv = (TextView) layout.findViewById(R.id.welcome_content_subject_tv); welcome_content_subject_detail_tv = (TextView) layout.findViewById(R.id.welcome_content_subject_detail_tv); ImageView welcome_content_iconlay = (ImageView) layout.findViewById(R.id.welcome_content_iconlay) .findViewById(R.id.welcome_content_iconlay_iv); switch (content) { case 0:/* w w w . j a v a2 s .com*/ layout.setBackgroundResource(R.drawable.qo_startup_screen1); welcome_content_iconlay.setImageResource(R.drawable.icon); break; case 1: layout.setBackgroundResource(R.drawable.qo_startup_screen2); welcome_content_subject_tv.setText(getString(R.string.emm_license_welcome_pager2_title)); welcome_content_subject_detail_tv.setText(getString(R.string.emm_license_welcome_pager2_content)); break; case 2: layout.setBackgroundResource(R.drawable.qo_startup_screen3); welcome_content_iconlay.setImageResource(R.drawable.icon); welcome_content_subject_tv.setText(getString(R.string.emm_license_welcome_pager3_title)); welcome_content_subject_detail_tv.setText(getString(R.string.emm_license_welcome_pager3_content)); break; default: break; } return layout; }
From source file:moose.com.ac.ui.CommentAdapter.java
private RelativeLayout generateQuoteFrame(CommentListWrapper.Comment quote) { RelativeLayout quoteFrame = (RelativeLayout) mInflater.inflate(R.layout.comments_quote_item, null); TextView username = (TextView) quoteFrame.findViewById(R.id.user_name); username.setText(String.format(Locale.getDefault(), "#%d %s", quote.floor, quote.username)); TextView content = (TextView) quoteFrame.findViewById(R.id.comments_content); TextViewUtils.setCommentContent(content, quote.content); if (onItemClickListener != null) { quoteFrame.setOnClickListener(v -> onItemClickListener.onItemClick(null, v, quote)); }/*from w w w .ja v a 2s .co m*/ return quoteFrame; }
From source file:com.semfapp.adamdilger.semf.Take5RecyclerFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_take5_empty_list, container, false); recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view); recyclerView.setAdapter(adapter);/*from w w w . j a va 2 s . co m*/ recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); recyclerView.addItemDecoration(new HorizontalDividerItemDecoration.Builder(getContext()).build()); RelativeLayout headerView = (RelativeLayout) inflater.inflate(R.layout.take5_recycler_header, null); TextView textView = (TextView) headerView.findViewById(R.id.header_title); textView.setText(title); recyclerView.addItemDecoration(new HeaderDecoration(headerView, false, 0f, 1)); return view; }
From source file:com.antew.redditinpictures.ui.RedditImageGridFragmentFree.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { RelativeLayout v = (RelativeLayout) super.onCreateView(inflater, container, savedInstanceState); mGridView = (GridView) v.findViewById(R.id.gridView); LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mHideAds, new IntentFilter(ConstsFree.REMOVE_ADS)); /**/*from w ww. ja va 2 s .c om*/ * If ads are disabled we don't need to load any */ if (!SharedPreferencesHelperFree.getDisableAds(getActivity())) { mAdView = new AdView(getActivity(), AdSize.SMART_BANNER, ConstsFree.ADMOB_ID); /** * The AdView should be attached to the bottom of the screen, with the GridView position above it */ RelativeLayout.LayoutParams adParams = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); v.addView(mAdView, adParams); /** * We use the onGlobalLayoutListener here in order to adjust the bottom margin of the GridView * so that when the user scrolls to the bottom of the GridView the last images are not obscured * by the AdView */ mAdView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { if (mAdView != null && mGridView != null) { int height = mAdView.getHeight(); if (height > 0) { RelativeLayout.LayoutParams gridViewParams = (RelativeLayout.LayoutParams) mGridView .getLayoutParams(); gridViewParams.setMargins(0, 0, 0, height); mGridView.setLayoutParams(gridViewParams); mAdView.getViewTreeObserver().removeGlobalOnLayoutListener(this); } } } }); mAdView.loadAd(AdUtil.getAdRequest()); } return v; }
From source file:fm.feed.android.testapp.fragment.SlidingFragment.java
@Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { RelativeLayout rootView = (RelativeLayout) inflater.inflate(R.layout.fragment_sliding, container, false); /**/* w w w. java2 s .co m*/ * Override default PlayerView Shared Subject title */ PlayerView playerView = (PlayerView) rootView.findViewById(R.id.player); playerView.setShareSubject("Currently listening from a sliding panel!"); int margin = (int) UIUtils.convertDpToPixel(getActivity(), getResources().getDimension(R.dimen.player_padding)); int sizeBaseline = (int) UIUtils.convertDpToPixel(getActivity(), DEFAULT_SVG_SIZE_DP) + margin * 2; SVGImageView closeButton = new SVGImageView(getActivity()); try { closeButton.setSVG(SVG.getFromResource(getActivity(), R.drawable.ic_backarrow_normal)); closeButton.setContentDescription(getString(R.string.accessibility_back)); } catch (SVGParseException e) { e.printStackTrace(); } RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(sizeBaseline, sizeBaseline); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); closeButton.setLayoutParams(layoutParams); closeButton.setScaleType(ImageView.ScaleType.FIT_START); int padding = sizeBaseline / 4; closeButton.setPadding(margin, margin, margin, margin); closeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getActivity().onBackPressed(); } }); playerView.addView(closeButton); return rootView; }
From source file:fr.ippon.android.opendata.android.AbstractParkingListFragment.java
/** * {@inheritDoc}/* w ww . j a va 2 s .c o m*/ */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.d(TAG, "onCreateView"); RelativeLayout r = (RelativeLayout) inflater.inflate(R.layout.list, null); emptyText = (TextView) r.findViewById(android.R.id.empty); headerView = inflater.inflate(R.layout.items_parkings_header, null); // Branchement du listener sur les preferences SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); prefs.registerOnSharedPreferenceChangeListener(spChanged); configureSearchField(r); locationDispatcher.addListener(locationListener); return r; }
From source file:fm.feed.android.playersdk.fragment.SlidingPlayerFragment.java
@Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { RelativeLayout rootView = (RelativeLayout) inflater.inflate(R.layout.feed_fm_sliding_player_fragment, container, false);//from w w w. j av a2 s . c o m /** * Override default PlayerView Shared Subject title */ PlayerView playerView = (PlayerView) rootView.findViewById(R.id.player); playerView.setShareSubject("Currently listening from a sliding panel!"); int margin = (int) UIUtils.convertDpToPixel(getActivity(), getResources().getDimension(R.dimen.player_padding)); int sizeBaseline = (int) UIUtils.convertDpToPixel(getActivity(), DEFAULT_SVG_SIZE_DP) + margin * 2; SVGImageView closeButton = new SVGImageView(getActivity()); try { closeButton.setSVG(SVG.getFromResource(getActivity(), R.drawable.ic_backarrow_normal)); closeButton.setContentDescription(getString(R.string.accessibility_back)); } catch (SVGParseException e) { e.printStackTrace(); } RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(sizeBaseline, sizeBaseline); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); closeButton.setLayoutParams(layoutParams); closeButton.setScaleType(ImageView.ScaleType.FIT_START); int padding = sizeBaseline / 4; closeButton.setPadding(margin, margin, margin, margin); closeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getActivity().onBackPressed(); } }); playerView.addView(closeButton); return rootView; }