private static ImageView getAccessoryView(ATableViewCell cell, ATableViewCellAccessoryType accessoryType) { LinearLayout containerView = (LinearLayout) cell.findViewById(R.id.containerView); // check if accessoryView already exists for current cell before creating a new instance. ImageView accessoryView = (ImageView) containerView.findViewById(R.id.accessoryView); if (accessoryView == null) { Resources res = cell.getResources(); // get marginRight for accessoryView, DisclosureButton has a different one. LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); int marginRight = (int) res.getDimension(R.dimen.atv_cell_content_margin); if (accessoryType == ATableViewCellAccessoryType.DisclosureButton) { marginRight = (int) res.getDimension(R.dimen.atv_cell_disclosure_button_margin_right); } params.setMargins(0, 0, marginRight, 0); // setup. accessoryView = new ATableViewCellAccessoryView(cell.getContext()); accessoryView.setId(R.id.accessoryView); accessoryView.setLayoutParams(params); containerView.addView(accessoryView); } return accessoryView; }
@Override public void getViews() { mProjectionBtn = (TextView) findViewById(R.id.tv_projectin_btn); mBackBtn = (LinearLayout) findViewById(R.id.ll_slide_back); mViewPager = (LoopViewPager) findViewById(R.id.viewpager); finsh = (LinearLayout) findViewById(R.id.ll_slide_finish); mCurrentPaeTv = (TextView) findViewById(R.id.tv_current_page); tv_current_type = (TextView) findViewById(R.id.tv_current_type); mSectorMenu = (SectorMenuButton) findViewById(R.id.sectorMenuBtn); mSlideAdapter = new SlideAdapter(this); mSlideAdapter.setData(mSlideList); mViewPager.setAdapter(mSlideAdapter); mViewPager.setOnPageChangeListener(this); currentPager = mDefaultPosition; // mViewPager.setCurrentItem(currentPager, false); mPauseBtn = (ImageView) findViewById(R.id.iv_pause); }
public ViewHolder(final View itemView) { super(itemView); tv_nameCn = (AlwaysMarqueeTextView) itemView.findViewById(R.id.tv_top_left); tv_down_left = (AlwaysMarqueeTextView) itemView.findViewById(R.id.tv_down_left); tv_country = (AppCompatTextView) itemView.findViewById(R.id.tv_top_right); tv_status = (AppCompatTextView) itemView.findViewById(R.id.tv_down_right); ll_content = (LinearLayout) itemView.findViewById(R.id.ll_content); ll_content.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { T_ContactsCompanyEntity.RowsEntity rowsEntity = list.get(getLayoutPosition()); T_ContactsCompanyDetailsActivity_.intent(T_ContactsCompanyListFragment.this).extra(AppDelegate.ROWS_ENTITY, rowsEntity).start(); } }); }
/** * Initialize view */ public void initView() { isInitialized = true; removeAllViews(); setOrientation(VERTICAL); setGravity(Gravity.BOTTOM); setBackgroundColor(headerBackgroundColor); LinearLayout mContainer = viewHelper.generateContainerLayout(); addView(mContainer); characterViewList = viewHelper.generateCharacterViewList(headerText); for (TextView textView : characterViewList) { mContainer.addView(textView); } setupAnimation(); }
public void addMessageBox(String message, int type){ TextView textView = new TextView(ChatActivity.this); textView.setText(message); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp.setMargins(0, 0, 0, 10); textView.setLayoutParams(lp); if(type == 1) { textView.setBackgroundResource(R.drawable.rounded_corner1); } else{ textView.setBackgroundResource(R.drawable.rounded_corner2); } mLinearlayout.addView(textView); mScrollview.fullScroll(View.FOCUS_DOWN); }
public SlidingTabLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); setFillViewport(true);//设置滚动视图是否可以伸缩其内容以填充视口 setWillNotDraw(false);//重写onDraw方法,需要调用这个方法来清除flag setClipChildren(false); setClipToPadding(false); this.mContext = context; mTabsContainer = new LinearLayout(context); addView(mTabsContainer); obtainAttributes(context, attrs); //get layout_height String height = attrs.getAttributeValue("http://schemas.android.com/apk/res/android", "layout_height"); if (height.equals(ViewGroup.LayoutParams.MATCH_PARENT + "")) { } else if (height.equals(ViewGroup.LayoutParams.WRAP_CONTENT + "")) { } else { int[] systemAttrs = {android.R.attr.layout_height}; TypedArray a = context.obtainStyledAttributes(attrs, systemAttrs); mHeight = a.getDimensionPixelSize(0, ViewGroup.LayoutParams.WRAP_CONTENT); a.recycle(); } }
public static void showCenterToast(Context context, String title, @DrawableRes int drawableId, int duration) { Toast toast = makeText(context.getApplicationContext(), title, duration); toast.setGravity(Gravity.CENTER, 0, 0); View view = LayoutInflater.from(context).inflate(R.layout.layout_center_toast, null); LinearLayout rlContent = (LinearLayout) view.findViewById(R.id.rl_content); TextView content = (TextView) view.findViewById(R.id.tv_content); ImageView alertIcon = (ImageView) view.findViewById(R.id.iv_icon); if (drawableId != 0) { alertIcon.setVisibility(View.VISIBLE); alertIcon.setImageResource(drawableId); } else { alertIcon.setVisibility(View.GONE); } if (!TextUtils.isEmpty(title)) { content.setText(title); } WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); int screenWidth = wm.getDefaultDisplay().getWidth(); int width = (int) (screenWidth / 2f); FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) rlContent.getLayoutParams(); lp.width = width; rlContent.setLayoutParams(lp); rlContent.requestLayout(); toast.setView(view); toast.show(); }
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); viewLayout = new LinearLayout(this); viewLayout.setOrientation(LinearLayout.HORIZONTAL); frameLayout = new FrameLayout(this); frameLayout.addView(viewLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); frameLayout.setBackgroundColor(0xFFFFFFFF); // COLOR_WHITE XXX setContentView(frameLayout); frameLayout.requestLayout(); hasSurface = false; }
public PhotoPostVH(View itemView) { super(itemView); context = itemView.getContext(); avatarView = (SimpleDraweeView) itemView.findViewById(R.id.post_avatar); nameView = (TextView) itemView.findViewById(R.id.post_name); itemView.findViewById(R.id.post_header).setOnClickListener(this); timeView = (TextView) itemView.findViewById(R.id.post_time); sourceView = (TextView) itemView.findViewById(R.id.post_source); sourceView.setOnClickListener(this); contentLayout = (FlexboxLayout) itemView.findViewById(R.id.post_content); trailLayout = (LinearLayout) itemView.findViewById(R.id.post_trail); noteCountView = (TextView) itemView.findViewById(R.id.note_count); reblogView = (ImageView) itemView.findViewById(R.id.post_reblog); reblogView.setOnClickListener(this); likeView = (ImageView) itemView.findViewById(R.id.post_like); likeView.setOnClickListener(this); dividerWidth = (int) Utils.dp2Pixels(context, 4); deleteStub = (ViewStub) itemView.findViewById(R.id.stub_delete_forever); isSimpleMode = DataManager.getInstance().isSimpleMode(); if (isSimpleMode) { trailLayout.setVisibility(View.GONE); } }
@Override protected void onResume() { super.onResume(); String[] names_of = fileList(); //arr.length int name_size = names_of.length; not=(LinearLayout)findViewById(R.id.not); ListView names = (ListView)findViewById(R.id.LIST); ArrayAdapter<String> nameAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, names_of); if (names_of.length<1){ not.setVisibility(View.VISIBLE); names.setVisibility(View.GONE); }else { not.setVisibility(View.GONE); names.setVisibility(View.VISIBLE); } names.setAdapter(nameAdapter); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LinearLayout root = new LinearLayout(this); root.setPadding(30, 30, 30, 30); FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT); root.setLayoutParams(lp); setContentView(root); // textView TextView textView = new TextView(this); textView.setText("Theme: Dialog"); textView.setGravity(Gravity.CENTER); textView.setTextSize(30); LinearLayout.LayoutParams lp2 = new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT); textView.setLayoutParams(lp2); root.addView(textView); }
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { CommonIndicator mCommonIndicator=new CommonIndicator(this.getActivity()); FrameLayout.LayoutParams lp=new FrameLayout.LayoutParams(-2,-2); lp.gravity= Gravity.CENTER; ProgressBar mProgressBar=new ProgressBar(this.getActivity()); mProgressBar.setBackground(this.getResources().getDrawable(R.drawable.indicator_shape)); mCommonIndicator.addView(mProgressBar,lp); this.mAgentWebX5 = AgentWebX5.with( this)// .setAgentWebParent((ViewGroup) view, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT))// .setCustomIndicator(mCommonIndicator) .setWebSettings(WebDefaultSettingsManager.getInstance())// .setWebViewClient(mWebViewClient) .setReceivedTitleCallback(mCallback) .setSecurityType(AgentWebX5.SecurityType.strict) .createAgentWeb()// .ready()// .go(getUrl()); initView(view); }
@Override protected void initView(Bundle bundle) { super.initView(bundle); GlideManager.loadCircleImg("https://avatars3.githubusercontent.com/u/19605922?v=4&s=460", ivHead); titleBarDrawer.setImmersible(mContext, isImmersible, isLight); vHeader = View.inflate(mContext, R.layout.layout_title_header, null); sBtnImmersible = (SwitchCompat) vHeader.findViewById(R.id.sBtn_immersible); sBtnLight = (SwitchCompat) vHeader.findViewById(R.id.sBtn_light); sBtnLine = (SwitchCompat) vHeader.findViewById(R.id.sBtn_line); lLayoutAlpha = (LinearLayout) vHeader.findViewById(R.id.lLayout_alpha); sBarAlpha = (SeekBar) vHeader.findViewById(R.id.sBar_alpha); tvStatusAlpha = (TextView) vHeader.findViewById(R.id.tv_statusAlpha); initView(); setDrawerList(); initData(); }
private void initWidgets() { View view = LayoutInflater.from(getContext()) .inflate(R.layout.view_tab_picker, this, false); mRecyclerActive = (RecyclerView) view.findViewById(R.id.view_recycler_active); mRecyclerInactive = (RecyclerView) view.findViewById(R.id.view_recycler_inactive); mViewScroller = (NestedScrollView) view.findViewById(R.id.view_scroller); mLayoutTop = (RelativeLayout) view.findViewById(R.id.layout_top); mViewWrapper = (LinearLayout) view.findViewById(R.id.view_wrapper); mViewDone = (TextView) view.findViewById(R.id.tv_done); mViewOperator = (TextView) view.findViewById(R.id.tv_operator); mLayoutWrapper = (LinearLayout) view.findViewById(R.id.layout_wrapper); mViewDone.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mViewDone.getText().toString().equals("排序删除")) { mActiveAdapter.startEditMode(); } else { mActiveAdapter.cancelEditMode(); } } }); addView(view); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_cmb_china_login); /** init view **/ mMainContainer = (LinearLayout) findViewById(R.id.activity_cmb_china_login); mCardNum = (BootstrapEditText) findViewById(R.id.user_card_num); mPassword = (BootstrapEditText) findViewById(R.id.user_password); mValidCode = (BootstrapEditText) findViewById(R.id.user_valid_code); valideCodeImage = (ImageView) findViewById(R.id.image_valid_code); valideCodeImage.setOnClickListener(this); mContext = this; loginBtn = (BootstrapButton) findViewById(R.id.loginCmbChinaBtn); loginBtn.setOnClickListener(this); httpRequestManager = HttpRequestManager.getInstance(); updateValidCodeAction(); }
/********************************************************* * Helper static methods *********************************************************/ private static FormulaBase getNextFormula(LinearLayout l, int idx) { if (idx == ViewUtils.INVALID_INDEX) { return null; } int targetIdx = ViewUtils.INVALID_INDEX; if (idx < l.getChildCount()) { targetIdx = idx; } else if ((idx - 1) < l.getChildCount()) { targetIdx = idx - 1; } else if (l.getChildCount() > 0) { targetIdx = l.getChildCount() - 1; } FormulaBase f = null; if (targetIdx != ViewUtils.INVALID_INDEX) { View v = l.getChildAt(targetIdx); if (v instanceof ListRow) { ListRow row = (ListRow) v; if (row.getChildCount() > 0) { v = row.getChildAt(0); } } if (v instanceof FormulaBase) { f = (FormulaBase) v; } } return f; }
public PRTHeader(Context context) { super(context); int[] size = ResHelper.getScreenSize(context); float screenWidth = size[0] < size[1] ? size[0] : size[1]; float ratio = screenWidth / DESIGN_SCREEN_WIDTH; setOrientation(VERTICAL); LinearLayout llInner = new LinearLayout(context); LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_HORIZONTAL; addView(llInner, lp); ivArrow = new RotateImageView(context); int resId = ResHelper.getBitmapRes(context, "ssdk_oks_ptr_ptr"); if (resId > 0) { ivArrow.setImageResource(resId); } int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH); lp = new LayoutParams(avatarWidth, avatarWidth); lp.gravity = Gravity.CENTER_VERTICAL; int avataPadding = (int) (ratio * DESIGN_AVATAR_PADDING); lp.topMargin = lp.bottomMargin = avataPadding; llInner.addView(ivArrow, lp); pbRefreshing = new ProgressBar(context); resId = ResHelper.getBitmapRes(context, "ssdk_oks_classic_progressbar"); Drawable pbdrawable = context.getResources().getDrawable(resId); pbRefreshing.setIndeterminateDrawable(pbdrawable); llInner.addView(pbRefreshing, lp); pbRefreshing.setVisibility(View.GONE); tvHeader = new TextView(getContext()); tvHeader.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tvHeader.setPadding(avataPadding, 0, avataPadding, 0); tvHeader.setTextColor(0xff09bb07); lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.gravity = Gravity.CENTER_VERTICAL; llInner.addView(tvHeader, lp); }
/** * Create a default view to be used for tabs. This is called if a custom tab view is not set via * {@link #setCustomTabView(int, int)}. */ protected TextView createDefaultTabView(CharSequence title) { TextView textView = new TextView(getContext()); textView.setGravity(Gravity.CENTER); textView.setText(title); textView.setTextColor(tabViewTextColors); textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabViewTextSize); textView.setTypeface(Typeface.DEFAULT_BOLD); textView.setLayoutParams(new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT)); if (tabViewBackgroundResId != NO_ID) { textView.setBackgroundResource(tabViewBackgroundResId); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // If we're running on Honeycomb or newer, then we can use the Theme's // selectableItemBackground to ensure that the View has a pressed state TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); textView.setBackgroundResource(outValue.resourceId); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style textView.setAllCaps(tabViewTextAllCaps); } textView.setPadding( tabViewTextHorizontalPadding, 0, tabViewTextHorizontalPadding, 0); if (tabViewTextMinWidth > 0) { textView.setMinWidth(tabViewTextMinWidth); } return textView; }
public View getView(int index, View convertView, ViewGroup parent) { if (convertView == null) { convertView = createPanel(parent.getContext()); } LinearLayout llPanel = ResHelper.forceCast(convertView); LinearLayout[] llCells = ResHelper.forceCast(llPanel.getTag()); refreshPanel(llCells, cells[index]); return convertView; }
private void initViews() { // input bar messageActivityBottomLayout = (LinearLayout) view.findViewById(R.id.messageActivityBottomLayout); messageInputBar = view.findViewById(R.id.textMessageLayout); switchToTextButtonInInputBar = view.findViewById(R.id.buttonTextMessage); switchToAudioButtonInInputBar = view.findViewById(R.id.buttonAudioMessage); moreFuntionButtonInInputBar = view.findViewById(R.id.buttonMoreFuntionInText); emojiButtonInInputBar = view.findViewById(R.id.emoji_button); sendMessageButtonInInputBar = view.findViewById(R.id.buttonSendMessage); messageEditText = (EditText) view.findViewById(R.id.editTextMessage); // 语音 audioRecordBtn = (Button) view.findViewById(R.id.audioRecord); audioAnimLayout = view.findViewById(R.id.layoutPlayAudio); time = (Chronometer) view.findViewById(R.id.timer); timerTip = (TextView) view.findViewById(R.id.timer_tip); timerTipContainer = (LinearLayout) view.findViewById(R.id.timer_tip_container); // 表情 emoticonPickerView = (EmoticonPickerView) view.findViewById(R.id.emoticon_picker_view); // 显示录音按钮 switchToTextButtonInInputBar.setVisibility(View.GONE); switchToAudioButtonInInputBar.setVisibility(View.VISIBLE); // 文本录音按钮切换布局 textAudioSwitchLayout = (FrameLayout) view.findViewById(R.id.switchLayout); if (isTextAudioSwitchShow) { textAudioSwitchLayout.setVisibility(View.VISIBLE); } else { textAudioSwitchLayout.setVisibility(View.GONE); } }
private void addRightCustomViewOnActionBar(UI activity, List<SessionCustomization.OptionsButton> buttons) { if (buttons == null || buttons.size() == 0) { return; } Toolbar toolbar = getToolBar(); if (toolbar == null) { return; } LinearLayout view = (LinearLayout) LayoutInflater.from(activity).inflate(R.layout.nim_action_bar_custom_view, null); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT); for (final SessionCustomization.OptionsButton button : buttons) { ImageView imageView = new ImageView(activity); imageView.setImageResource(button.iconId); imageView.setBackgroundResource(R.drawable.nim_nim_action_bar_button_selector); imageView.setPadding(ScreenUtil.dip2px(10), 0, ScreenUtil.dip2px(10), 0); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { button.onClick(BaseMessageActivity.this, v, sessionId); } }); view.addView(imageView, params); } toolbar.addView(view, new Toolbar.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT, Gravity.RIGHT | Gravity.CENTER)); }
private void StartAnimations() { Animation anim = AnimationUtils.loadAnimation(this, R.anim.alpha); anim.reset(); LinearLayout l = (LinearLayout) findViewById(R.id.lin_lay); l.clearAnimation(); l.startAnimation(anim); anim = AnimationUtils.loadAnimation(this, R.anim.rotate); anim.reset(); ImageView iv = (ImageView) findViewById(R.id.splash); iv.clearAnimation(); iv.startAnimation(anim); splashTread = new Thread() { @Override public void run() { try { int waited = 0; while (waited < 3500) { sleep(100); waited += 100; } Intent intent = new Intent(Splashscreen.this, MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); startActivity(intent); Splashscreen.this.finish(); } catch (InterruptedException e) { } finally { Splashscreen.this.finish(); } } }; splashTread.start(); }
/** * 生成一个和状态栏大小相同的半透明矩形条 * * @param activity 需要设置的activity * @param color 状态栏颜色值 * @param alpha 透明值 * @return 状态栏矩形条 */ private static StatusBarView createStatusBarView(Activity activity, @ColorInt int color, int alpha) { // 绘制一个和状态栏一样高的矩形 StatusBarView statusBarView = new StatusBarView(activity); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getStatusBarHeight(activity)); statusBarView.setLayoutParams(params); statusBarView.setBackgroundColor(calculateStatusColor(color, alpha)); return statusBarView; }
@Override public View instantiateItem(ViewGroup container, int position) { TouchImageView img = new TouchImageView(container.getContext()); ImageLoader mLoader = new ImageLoader(container.getContext()); mLoader.DisplayImageFull(listimage.get(position), img); container.addView(img, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); return img; }
public ListItemAttachmentViewHolder(View itemView) { super(itemView); mContainer = (LinearLayout) itemView.findViewById(R.id.item_attachment_list_item_container); mCheckBox = (CheckBox) itemView.findViewById(R.id.list_item_attachment_list_item_checkbox); mTapToAdd = (ImageView) itemView.findViewById(R.id.list_item_attachment_list_item_tap_to_add); mText = (TextView) itemView.findViewById(R.id.list_item_attachment_list_item_text); //mMoreBtn = (ImageButton) itemView.findViewById(R.id.list_item_attachment_list_item_more); }
public SliderViewHolder(View view) { super(view); rootView = (LinearLayout) view.findViewById(R.id.root_view); tickMarkLabelsRelativeLayout = (RelativeLayout) view.findViewById(R.id.tick_mark_labels_rl); discreteSlider = (DiscreteSlider) view.findViewById(R.id.slider); title = (TextView) view.findViewById(R.id.title); }
public ViewHolder(View view) { super(view); mView = view; llTitleContainer = (LinearLayout) view.findViewById(R.id.llTitleContainer); tvTitle = (TextView) view.findViewById(R.id.tvTitle); tvDatetime = (TextView) view.findViewById(R.id.tvDatetime); tvText = (TextView) view.findViewById(R.id.tvText); }
@NonNull public View getView() { Snackbar.SnackbarLayout snackBarLayout = (Snackbar.SnackbarLayout) mSnackBar.getView(); boolean tabletMode = mBuilder.mContext.getResources().getBoolean(R.bool.cafebar_tablet_mode); if (tabletMode || mBuilder.mFloating) { CardView cardView = (CardView) snackBarLayout.getChildAt(0); return cardView.getChildAt(0); } LinearLayout linearLayout = (LinearLayout) snackBarLayout.getChildAt(0); if (mBuilder.mShowShadow) return linearLayout.getChildAt(1); return linearLayout.getChildAt(0); }
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if(getView() == null) return; LinearLayout playerContainer = getView().findViewById(R.id.player_container); LinearLayout chatContainer = getView().findViewById(R.id.chat_container); // Checks the orientation of the screen if(newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { oldPlayerLayoutParams = playerContainer.getLayoutParams(); oldChatLayoutParams = chatContainer.getLayoutParams(); chatContainer.setVisibility(View.GONE); playerContainer.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT)); hideSystemUi(); } else if(newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { showSystemUi(); chatContainer.setVisibility(View.VISIBLE); playerContainer.setLayoutParams(oldPlayerLayoutParams); chatContainer.setLayoutParams(oldChatLayoutParams); } }
public ViewHolder(View itemView) { super(itemView); place_image = (ImageView) itemView.findViewById(R.id.place_image); place_name = (TextView) itemView.findViewById(R.id.place_name); place_location = (TextView) itemView.findViewById(R.id.place_location); //TIMING timing_lay = (LinearLayout) itemView.findViewById(R.id.timing_lay); rating_view = (LinearLayout) itemView.findViewById(R.id.rating_view); created_time = (TextView) itemView.findViewById(R.id.created_time); dineline_rating = (TextView) itemView.findViewById(R.id.dineline_rating); //FOR REVIEW review_lay = (LinearLayout) itemView.findViewById(R.id.review_lay); review_details = (TextView) itemView.findViewById(R.id.review_details); review_image_lay = (LinearLayout) itemView.findViewById(R.id.review_image_lay); image1_holder = (CardView) itemView.findViewById(R.id.image1_holder); image2_holder = (CardView) itemView.findViewById(R.id.image2_holder); image3_holder = (CardView) itemView.findViewById(R.id.image3_holder); image4_holder = (CardView) itemView.findViewById(R.id.image4_holder); image5_holder = (CardView) itemView.findViewById(R.id.image5_holder); image1 = (ImageView) itemView.findViewById(R.id.image1); image2 = (ImageView) itemView.findViewById(R.id.image2); image3 = (ImageView) itemView.findViewById(R.id.image3); image4 = (ImageView) itemView.findViewById(R.id.image4); image5 = (ImageView) itemView.findViewById(R.id.image5); //FOR OPTIONS options_lay = (LinearLayout) itemView.findViewById(R.id.options_lay); myFont.setAppFont((ViewGroup) itemView, MyFont.FONT_REGULAR); //myFont.setFont(name, MyFont.FONT_BOLD); }
public static LinearLayout.LayoutParams getLinearLayoutParams(View v) { LinearLayout.LayoutParams genericParam = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); if (v == null) { return genericParam; } LinearLayout.LayoutParams viewParams = (LinearLayout.LayoutParams) v.getLayoutParams(); if (viewParams != null) { return viewParams; } else { return genericParam; } }
public ViewHolder(View view) { super(view); tvId = (TextView) view.findViewById(R.id.tvId); tvLocality = (TextView) view.findViewById(R.id.tvLocality); linearLayout = (LinearLayout) view.findViewById(R.id.linearLayout); btUpdate = (ImageButton) view.findViewById(R.id.btUpdate); }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment view = inflater.inflate(R.layout.fragment_community_group, container, false); mSwipeStack = (SwipeStack) view.findViewById(R.id.swipeStack); mButtonLeft = (Button) view.findViewById(R.id.buttonSwipeLeft); mButtonRight = (Button) view.findViewById(R.id.buttonSwipeRight); joinedGroupsList = new ArrayList<>(); progressBar = (ProgressBar) view.findViewById(R.id.main_progress); progressFrame = view.findViewById(R.id.community_Fragment_frame); txtError = (TextView) view.findViewById(R.id.error_txt_cause); error_btn_retry = (Button) view.findViewById(R.id.error_btn_retry); errorLayout = (LinearLayout) view.findViewById(R.id.error_layout); mButtonLeft.setOnClickListener(this); mButtonRight.setOnClickListener(this); groupId = new ArrayList<>(); try { loadFirstPage(); } catch (Exception e) { e.printStackTrace(); } // fillWithTestData(); return view; }
public void setupIndicator(RelativeLayout indicator) { this.indicator = indicator; if (indicator == null) { return; } if (indicator.getChildCount() > 0) { indicator.removeAllViews(); } ringList = new ArrayList<ImageView>(); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); LinearLayout ll = new LinearLayout(context); ll.setLayoutParams(lp); indicator.addView(ll); LinearLayout.LayoutParams lpp = new LinearLayout.LayoutParams(DisplayUtil.dp2px(7), DisplayUtil.dp2px(7)); for (int i = 0; i < pageCount; i++) { ImageView iv = new ImageView(context); iv.setLayoutParams(lpp); if (pageCount == 1) { iv.setBackgroundResource(R.drawable.ring_imageview_select); } if (i > 0) { lpp.leftMargin = DisplayUtil.dp2px(3); } ringList.add(iv); ll.addView(iv); } }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(1); this.layout = new LinearLayout(this); LayoutParams layoutParams = new LayoutParams(-1, -1); setContentView(this.layout); this.intent = getIntent(); Bundle bundle = this.intent.getExtras(); this.appid = bundle.getString("appid"); this.accesstoken = bundle.getString("accesstoken"); init(); }
public ComputerPartViewHolder(View view) { super(view); cardView = (CardView)view.findViewById(R.id.card_view); //TODO change the image programatically computer_part_img = (ImageView)view.findViewById(R.id.card_view_img); LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.card_view_linear_layout); textViews = new TextView[ComputerPartAdapter.listSize + 1]; //for space for (int i = 0; i < textViews.length; i++) { textViews[i] = new TextView(view.getContext()); linearLayout.setBackgroundColor(Color.TRANSPARENT); linearLayout.addView(textViews[i]); } }
@Override public void doOnViewCreated(View v, @Nullable Bundle savedInstanceState) { lastPostTextCont = (LinearLayout) v.findViewById(R.id.postsCont); userNameTextView = (TextView) v .findViewById(R.id.facebook_shield_username_textview); facebookLogin = (Button) v.findViewById(R.id.login); facebookLogout = (Button) v.findViewById(R.id.logout); progress = (ProgressBar) v.findViewById(R.id.progress); }
public void onCreate() { super.onCreate(); int screenHeight = ResHelper.getScreenHeight(activity); float ratio = ((float) screenHeight) / DESIGN_SCREEN_WIDTH; maxBodyHeight = 0; llPage = new LinearLayout(activity); llPage.setOrientation(LinearLayout.VERTICAL); activity.setContentView(llPage); rlTitle = new RelativeLayout(activity); rlTitle.setBackgroundColor(0xffe6e9ec); int titleHeight = (int) (DESIGN_TITLE_HEIGHT_L * ratio); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, titleHeight); llPage.addView(rlTitle, lp); initTitle(rlTitle, ratio); RelativeLayout rlBody = new RelativeLayout(activity); rlBody.setBackgroundColor(0xffffffff); lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); llPage.addView(rlBody, lp); initBody(rlBody, ratio); LinearLayout llShadow = new LinearLayout(activity); llShadow.setOrientation(LinearLayout.VERTICAL); rlBody.addView(llShadow, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); initShadow(llShadow, ratio); llBottom = new LinearLayout(activity); llBottom.setOrientation(LinearLayout.VERTICAL); lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); llPage.addView(llBottom, lp); initBottom(llBottom, ratio); }
/** * 创建半透明矩形 View * * @param alpha 透明值 * @return 半透明 View */ private static StatusBarView createTranslucentStatusBarView(Activity activity, int alpha) { // 绘制一个和状态栏一样高的矩形 StatusBarView statusBarView = new StatusBarView(activity); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getStatusBarHeight(activity)); statusBarView.setLayoutParams(params); statusBarView.setBackgroundColor(Color.argb(alpha, 0, 0, 0)); return statusBarView; }