List of usage examples for android.view ViewGroup findViewById
@Nullable public final <T extends View> T findViewById(@IdRes int id)
From source file:Main.java
/** * getContentView from an activity/* www .j av a 2 s .com*/ * @param activity * @return View */ public static View getContentView(Activity activity) { ViewGroup view = (ViewGroup) activity.getWindow().getDecorView(); ViewGroup content = (ViewGroup) view.findViewById(android.R.id.content); return content.getChildAt(0); }
From source file:com.king.base.BaseActivity.java
public static View getContentView(Activity activity) { ViewGroup view = (ViewGroup) activity.getWindow().getDecorView(); FrameLayout content = (FrameLayout) view.findViewById(android.R.id.content); return content.getChildAt(0); }
From source file:com.android.packageinstaller.permission.ui.PermissionAppsFragment.java
private static void bindUi(Fragment fragment, PermissionApps permissionApps) { final Drawable icon = permissionApps.getIcon(); final CharSequence label = permissionApps.getLabel(); final ActionBar ab = fragment.getActivity().getActionBar(); if (ab != null) { ab.setTitle(fragment.getString(R.string.permission_title, label)); }/*from www .j av a2s .c om*/ final ViewGroup rootView = (ViewGroup) fragment.getView(); final ImageView iconView = (ImageView) rootView.findViewById(R.id.lb_icon); if (iconView != null) { // Set the icon as the background instead of the image because ImageView // doesn't properly scale vector drawables beyond their intrinsic size iconView.setBackground(icon); } final TextView titleView = (TextView) rootView.findViewById(R.id.lb_title); if (titleView != null) { titleView.setText(label); } final TextView breadcrumbView = (TextView) rootView.findViewById(R.id.lb_breadcrumb); if (breadcrumbView != null) { breadcrumbView.setText(R.string.app_permissions); } }
From source file:com.android.mail.browse.ConversationItemViewCoordinates.java
@SuppressLint("NewApi") private static void setFramePadding(Context context, ViewGroup view, boolean useFullPadding) { final Resources res = context.getResources(); final int padding = res.getDimensionPixelSize( useFullPadding ? R.dimen.conv_list_card_border_padding : R.dimen.conv_list_no_border_padding); final View frame = view.findViewById(R.id.conversation_item_frame); if (Utils.isRunningJBMR1OrLater()) { // start, top, end, bottom frame.setPaddingRelative(frame.getPaddingStart(), padding, frame.getPaddingEnd(), padding); } else {// w w w.j a va 2s . c o m frame.setPadding(frame.getPaddingLeft(), padding, frame.getPaddingRight(), padding); } }
From source file:com.cw.litenote.note.NoteUi.java
public static void updateVideoPlayButtonState(ViewPager pager, int position) { ViewGroup pictureGroup = getPictureGroup(position, pager); Button videoPlayButton = null; if (pictureGroup != null) videoPlayButton = (Button) (pictureGroup.findViewById(R.id.video_view_play_video)); Button btn = videoPlayButton; if (btn == null) return;/*from ww w . j a va2s . c om*/ // show video play button icon int state = UtilVideo.getVideoState(); if (state == UtilVideo.VIDEO_AT_PLAY) { btn.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_media_pause, 0, 0, 0); btn.setVisibility(View.VISIBLE); } else if ((state == UtilVideo.VIDEO_AT_PAUSE) || (state == UtilVideo.VIDEO_AT_STOP)) { btn.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_media_play, 0, 0, 0); btn.setVisibility(View.VISIBLE); } }
From source file:com.hybris.mobile.lib.ui.view.Alert.java
/** * Set the icon on the alert/*from w ww.j a va 2 s . co m*/ * * @param context application-specific resources * @param configuration describes all device configuration information * @param mainView ViewGroup resources * @param textView alert message to be viewed message to be displayedView */ @SuppressLint("NewApi") private static void setIcon(Activity context, Configuration configuration, ViewGroup mainView, TextView textView) { ImageView imageView = (ImageView) mainView.findViewById(R.id.alert_view_icon); // Reset the current icon if (imageView != null) { mainView.removeView(imageView); } // On the textview as well textView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); textView.setCompoundDrawablePadding(0); if (configuration.getIconResId() != -1) { imageView = new ImageView(context); imageView.setId(R.id.alert_view_icon); imageView.setImageResource(configuration.getIconResId()); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); imageView.setLayoutParams(layoutParams); switch (configuration.getIconPosition()) { case LEFT_TEXT: textView.setCompoundDrawablesWithIntrinsicBounds(configuration.getIconResId(), 0, 0, 0); textView.setCompoundDrawablePadding(10); break; case RIGHT_TEXT: textView.setCompoundDrawablesWithIntrinsicBounds(0, 0, configuration.getIconResId(), 0); textView.setCompoundDrawablePadding(10); break; case LEFT: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { layoutParams.addRule(RelativeLayout.ALIGN_PARENT_START); } layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); layoutParams.setMargins(25, 0, 0, 0); mainView.addView(imageView); // We redefine the layout params otherwise the image is not well aligned textView.setLayoutParams( new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); break; case RIGHT: default: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { layoutParams.addRule(RelativeLayout.ALIGN_PARENT_END); } layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); layoutParams.setMargins(0, 0, 25, 0); mainView.addView(imageView); // We redefine the layout params otherwise the image is not well aligned textView.setLayoutParams( new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); break; } } }
From source file:com.cw.litenote.note.NoteUi.java
public static void primaryVideoSeekBarProgressUpdater(ViewPager pager, int curNotePos, int curVideoPos, String pictureUri) {//from w w w .j a va2s. c o m // System.out.println("NoteUi / _primaryVideoSeekBarProgressUpdater / curNotePos = " + curNotePos); if ((UtilVideo.mVideoView == null)) return; ViewGroup pictureGroup = getPictureGroup(curNotePos, pager); TextView videoView_currPosition = null; SeekBar videoView_seekBar = null; TextView videoView_fileLength = null; if (pictureGroup != null) { videoView_currPosition = (TextView) (pictureGroup.findViewById(R.id.video_current_pos)); videoView_seekBar = (SeekBar) (pictureGroup.findViewById(R.id.video_seek_bar)); videoView_fileLength = (TextView) (pictureGroup.findViewById(R.id.video_file_length)); } // show current play position if (videoView_currPosition != null) { videoView_currPosition.setText(Util.getTimeFormatString(curVideoPos)); videoView_currPosition.setVisibility(View.VISIBLE); } // show file length if (!Util.isEmptyString(pictureUri)) { // set file length if (videoView_fileLength != null) { videoView_fileLength.setText(Util.getTimeFormatString(videoFileLength_inMilliSeconds)); videoView_fileLength.setVisibility(View.VISIBLE); } } // show seek bar progress if (videoView_seekBar != null) { videoView_seekBar.setVisibility(View.VISIBLE); videoView_seekBar.setMax(99); videoView_progress = (int) (((float) curVideoPos / videoFileLength_inMilliSeconds) * 100); videoView_seekBar.setProgress(videoView_progress); } }
From source file:com.hybris.mobile.lib.ui.view.Alert.java
/** * Hide the alert/*from w w w . ja va2s.c o m*/ * * @param context application-specific resources * @param configuration describes all device configuration information */ public static void hide(Activity context, Configuration configuration) { if (context == null) { throw new IllegalArgumentException("You must provide a configuration and/or context for the alert."); } ViewGroup mainView = (ViewGroup) context.findViewById(android.R.id.content); int viewId = R.id.alert_view_top; configuration = setUpConfiguration(context, configuration, null); if (configuration.getOrientation().equals(Configuration.Orientation.BOTTOM)) { viewId = R.id.alert_view_bottom; } animOut(configuration, mainView, mainView.findViewById(viewId)); }
From source file:gov.wa.wsdot.android.wsdot.ui.BaseFragment.java
/** * Remove the ad so it doesn't take up any space. *///from ww w .ja va 2 s . co m protected void disableAds(ViewGroup root) { mAdView = (PublisherAdView) root.findViewById(R.id.publisherAdView); mAdView.setVisibility(View.GONE); }
From source file:angeloid.sopiane.vegaphoneinfo.Tab_Main.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup root = (ViewGroup) inflater.inflate(R.layout.tab_tab1, null); welcome_image = (ImageView) root.findViewById(R.id.tab_tab1_welcome_image); welcome1 = (TextView) root.findViewById(R.id.tab_tab1_welcome_text); welcome1.setTypeface(Tab_MainActivity.Fonts.THEOREM); return root;//from w w w . java 2 s. c om }