/** * 在 TopBar 的中间添加 View,如果此前已经有 View 通过该方法添加到 TopBar,则旧的View会被 remove * * @param view 要添加到TopBar中间的View */ public void setCenterView(View view) { if (mCenterView == view) { return; } if (mCenterView != null) { removeView(mCenterView); } mCenterView = view; LayoutParams params = (LayoutParams) mCenterView.getLayoutParams(); if (params == null) { params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); } params.addRule(RelativeLayout.CENTER_IN_PARENT); addView(view, params); }
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK) { mCurrentPhotoPath = data.getStringExtra(ValueHelper.TAKEN_IMAGE_PATH); if (mCurrentPhotoPath != null) { ((RelativeLayout)getActivity().findViewById(R.id.fragment_note)).setVisibility(View.VISIBLE); setPic(); } } else if (resultCode == Activity.RESULT_CANCELED) { // if (((RelativeLayout)getActivity().findViewById(R.id.fragment_new_tree)).getVisibility() != View.VISIBLE) { // getActivity().getSupportFragmentManager().popBackStack(); // } } }
private void setTitleStyleUI() { if (titles.size() != imageUrls.size()) { throw new RuntimeException("[Banner] --> The number of titles and images is different"); } if (titleBackground != -1) { titleView.setBackgroundColor(titleBackground); } if (titleHeight != -1) { titleView.setLayoutParams(new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, titleHeight)); } if (titleTextColor != -1) { bannerTitle.setTextColor(titleTextColor); } if (titleTextSize != -1) { bannerTitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleTextSize); } if (titles != null && titles.size() > 0) { bannerTitle.setText(titles.get(0)); bannerTitle.setVisibility(View.VISIBLE); titleView.setVisibility(View.VISIBLE); } }
public ViewHolder(final View itemView) { super(itemView); tv_warning_export_invoice_number = (AlwaysMarqueeTextView) itemView.findViewById(R.id.tv_warning_export_invoice_number); tv_warning_foreign_businessman = (AlwaysMarqueeTextView) itemView.findViewById(R.id.tv_warning_foreign_businessman); tv_warning_invoice_unit = (AppCompatTextView) itemView.findViewById(R.id.tv_warning_invoice_unit); tv_warning_amount = (AppCompatTextView) itemView.findViewById(R.id.tv_warning_amount); tv_warning_invoice_date = (AppCompatTextView) itemView.findViewById(R.id.tv_warning_invoice_date); tv_warning_declare_date = (AppCompatTextView) itemView.findViewById(R.id.tv_warning_declare_date); tv_warning_approve_expiration_date = (AppCompatTextView) itemView.findViewById(R.id.tv_warning_approve_expiration_date); tv_warning_order_serial_number = (AppCompatTextView) itemView.findViewById(R.id.tv_warning_order_serial_number); tv_warning_po_number = (AppCompatTextView) itemView.findViewById(R.id.tv_warning_po_number); tv_warning_create_date = (AppCompatTextView) itemView.findViewById(R.id.tv_warning_create_date); rl_content = (RelativeLayout) itemView.findViewById(R.id.rl_content); rl_content.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); }
public ComplexButton(Context context, @Nullable AttributeSet attrs) { super(context, attrs); LayoutInflater.from(context).inflate(R.layout.complex_button, this); button = (RelativeLayout) findViewById(R.id.complex_button_body); rightArrow = (ImageView) findViewById(R.id.complex_button_item_right_arrow); circleImageView = (CircleImageView) findViewById(R.id.complex_button_item_image); itemName = (TextView) findViewById(R.id.complex_button_item_name); detail = (TextView) findViewById(R.id.complex_button_item_detail); redDot = (ImageView) findViewById(R.id.complex_button_red_dot); redDot.setVisibility(GONE); setButtonClickable(true); button.setLongClickable(true); button.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View view) { return true; } }); selectType(TYPE_IMAGE_ROUND); }
public MyViewHolder(final View itemView) { super(itemView); rl_cb_item = (RelativeLayout) itemView.findViewById(R.id.rl_cb_item); cb_item = (CheckBox) itemView.findViewById(R.id.cb_item); iv_item_goods = (ImageView) itemView.findViewById(R.id.iv_item_goods); iv_item_plus = (ImageView) itemView.findViewById(R.id.iv_item_plus); iv_item_reduce = (ImageView) itemView.findViewById(R.id.iv_item_reduce); iv_csb_jifen = (ImageView) itemView.findViewById(R.id.iv_csb_jifen); iv_text_csb_jifen = (ImageView) itemView.findViewById(R.id.iv_text_csb_jifen); tv_item_name = (TextView) itemView.findViewById(R.id.tv_item_name); tv_item_price_one = (TextView) itemView.findViewById(R.id.tv_item_price_one); tv_item_type = (TextView) itemView.findViewById(R.id.tv_item_type); tv_item_price_add = (TextView) itemView.findViewById(R.id.tv_item_price_add); tv_item_num = (TextView) itemView.findViewById(R.id.tv_item_num); // dl_item_cart = (DrawerLayout) itemView.findViewById(R.id.dl_item_cart); tv_item_cart_delete = (TextView) itemView.findViewById(R.id.tv_item_cart_delete); }
/** * 只允许new View的形式创建 */ public DiaryPageContentView(Context context, int teamId, int year, int week) { this.teamId = teamId; this.year = year; this.week = week; this.cxt = (Activity) context; rootView = (RelativeLayout) View.inflate(context, R.layout.pager_item_diary, null); listview = (ListView) rootView.findViewById(R.id.diary_listview); pullHeadView = (SwipeRefreshLayout) rootView .findViewById(R.id.swiperefreshlayout); errorLayout = (EmptyLayout) rootView.findViewById(R.id.error_layout); adapter = new TeamDiaryListAdapter(cxt, null); initView(); requestData(true); }
private void init(View view) { countryName = (TextView) view.findViewById(R.id.textView11); if( MainActivity.locationInfo != null) countryName.setText(getResources().getConfiguration().locale.getDisplayLanguage() .equals("العربية") ? ConfigPreferences.getLocationConfig(getContext()).name_english : ConfigPreferences.getLocationConfig(getContext()).name); Quibladegree = (TextView) view.findViewById(R.id.textView12); Quibladegree.setText("Qibla direction from North: "+ ConfigPreferences.getQuibla(getContext())); indicator = (ImageView) view.findViewById(R.id.imageView2); compass = (RelativeLayout) view.findViewById(R.id.compassContainer); mSensorManager = (SensorManager) getContext().getSystemService(getContext().SENSOR_SERVICE); RotateAnimation ra = new RotateAnimation(currentDegree, MainActivity.quiblaDegree, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); ra.setDuration(400); ra.setFillAfter(true); indicator.startAnimation(ra); }
@Override public void onBindViewHolder(WallpViewHolder holder, int position) { Hit photo = this.hit.get(position); RelativeLayout.LayoutParams rlp = (RelativeLayout.LayoutParams) holder.discWallp.getLayoutParams(); float height =photo.getPreviewHeight(); float width = photo.getPreviewWidth(); float ratio = height/width ; rlp.height = (int) (rlp.width * ratio); holder.discWallp.setLayoutParams(rlp); holder.discWallp.setRatio(ratio); File file = new File(Environment.getExternalStoragePublicDirectory("/"+R.string.app_name), photo.getId()+context.getResources().getString(R.string.jpg)); Picasso.with(context) .load(file) .placeholder(R.drawable.plh) .into(holder.discWallp); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tvPulsa = (TextView) findViewById(R.id.tvPulsa); rl = (RelativeLayout) findViewById(R.id.activity_main); animation = AnimationUtils.loadAnimation(this, R.anim.fadeinout); tvPulsa.startAnimation(animation); rl.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { Intent intent = new Intent(MainActivity.this, MenuActivity.class); startActivity(intent); return true; } }); }
public ViewHolder(View itemView, Context c) { super(itemView); rlContactRow = (RelativeLayout) itemView.findViewById(R.id.rlContactRow); ivContactImage = (ImageView) itemView.findViewById(R.id.ivContactImage); tvContactName = (TextView) itemView.findViewById(R.id.tvContactName); tvAffiliation = (TextView) itemView.findViewById(R.id.tvAffiliation); rlContactRow.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(!StringUtils.isNullOrEmpty(member.getAffiliation().val()) && StringUtils.safeEquals(member.getAffiliation().val(), ChatRoom.Affiliation.ADMIN.val()) || StringUtils.safeEquals(member.getAffiliation().val(), ChatRoom.Affiliation.OWNER.val())){ ChatRoom.ChatRoomMember m = memberList.get(getAdapterPosition()); if(!StringUtils.safeEquals(member.getUserJID().getBareJID(), m.getUserJID().getBareJID())){ showRemoveParticipantAlert(member.getUserJID(), getAdapterPosition()); } } } }); }
private void initView(Context context) { rootView = View.inflate(context, R.layout.widget_hor_controller, this); layout_topbar = (RelativeLayout) findViewById(R.id.layout_topbar); img_btn_back = (ImageView) findViewById(R.id.img_btn_back); top_ll = (LinearLayout) findViewById(R.id.top_ll); check_gift_switch = (CheckBox) findViewById(R.id.check_gift_switch); txt_btn_clarity = (TextView) findViewById(R.id.txt_btn_clarity); check_focus = (CheckBox) findViewById(R.id.check_focus); img_btn_share = (ImageView) findViewById(R.id.img_btn_share); txt_btn_describe = (TextView) findViewById(R.id.txt_btn_describe); txt_get_seed = (TextView) findViewById(R.id.txt_get_seed); lv_quality = (ListView) findViewById(R.id.lv_quality); tv_volume_brightness = (TextView) findViewById(R.id.tv_volume_brightness); layout_bottom_thelive = (LinearLayout) findViewById(R.id.layout_bottom_thelive); player_switch = (CheckBox) findViewById(R.id.rad_btn_player_switch); img_btn_refresh = (ImageView) findViewById(R.id.img_btn_refresh); txt_btn_hot_word = (ImageView) findViewById(R.id.txt_btn_hot_word); ediit_comment = (EditText) findViewById(R.id.ediit_comment); img_btn_send = (ImageView) findViewById(R.id.img_btn_send); rad_btn_danmu_switch = (CheckBox) findViewById(R.id.rad_btn_danmu_switch); img_btn_gift = (ImageView) findViewById(R.id.img_btn_gift); }
@Override public void setupDialog(Dialog dialog, int style) { View contentView = View.inflate(getContext(), R.layout.filter_sample_view, null); RelativeLayout rl_content = (RelativeLayout) contentView.findViewById(R.id.rl_content); LinearLayout ll_buttons = (LinearLayout) contentView.findViewById(R.id.ll_buttons); contentView.findViewById(R.id.btn_close).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { closeFilter("closed"); } }); //params to set setAnimationDuration(600); //optional; default 500ms setPeekHeight(300); // optional; default 400dp setCallbacks((Callbacks) getActivity()); //optional; to get back result setViewgroupStatic(ll_buttons); // optional; layout to stick at bottom on slide // setViewPager(vp_types); //optional; if you use viewpager that has scrollview setViewMain(rl_content); //necessary; main bottomsheet view setMainContentView(contentView); // necessary; call at end before super super.setupDialog(dialog, style); //call super at last }
private void init(Context context) { mContainerView = LayoutInflater.from(context).inflate(R.layout.widget_searchbar,this,false); search_img_bt = (ImageButton) mContainerView.findViewById(R.id.search_img_bt); search_edit_content = (RelativeLayout) mContainerView.findViewById(R.id.search_edit_content); search_edit = (EditText) mContainerView.findViewById(R.id.search_edit); search_tv = (TextView) mContainerView.findViewById(R.id.search_tv); search_clear = (ImageView) mContainerView.findViewById(R.id.search_clear); measureView(mContainerView); LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, mContainerView.getMeasuredHeight()); addView(mContainerView, params); if (isInterceptChild) { search_img_bt.setVisibility(GONE); search_tv.setVisibility(GONE); } else { search_img_bt.setVisibility(VISIBLE); search_tv.setVisibility(VISIBLE); } }
public ProgrammedRepeatingTaskViewHolder(View itemView, ViewHolderClickListener listener) { super(itemView); mClickListener = listener; mContainer = (RelativeLayout) itemView.findViewById(R.id.item_task_programmed_repeating_container); mCategoryIcon = (ImageView) itemView.findViewById(R.id.item_task_programmed_repeating_category_icon); mAttachmentList = (ImageView) itemView.findViewById(R.id.item_task_programmed_repeating_attachment_list); mAttachmentLink = (ImageView) itemView.findViewById(R.id.item_task_programmed_repeating_attachment_link); mAttachmentAudio = (ImageView) itemView.findViewById(R.id.item_task_programmed_repeating_attachment_audio); mAttachmentImage = (ImageView) itemView.findViewById(R.id.item_task_programmed_repeating_attachment_image); mAttachmentText = (ImageView) itemView.findViewById(R.id.item_task_programmed_repeating_attachment_text); mTitle = (TextView) itemView.findViewById(R.id.item_task_programmed_repeating_title); mDescription = (TextView) itemView.findViewById(R.id.item_task_programmed_repeating_description); mRepeat = (TextView) itemView.findViewById(R.id.item_task_programmed_repeating_repeat); mTime = (TextView) itemView.findViewById(R.id.item_task_programmed_repeating_time); mItemDecoration = itemView.findViewById(R.id.item_task_programmed_repeating_item_decoration); }
@Override public void getViews() { headLayout = (LinearLayout) findViewById(R.id.head_layout); iv_left = (ImageView) findViewById(R.id.iv_left); iv_right = (ImageView) findViewById(R.id.iv_right); toleft_iv_right = (ImageView) findViewById(R.id.toleft_iv_right); photoViewpager = (SolveViewPager) findViewById(R.id.photoViewpager); bottomTextLayout = (LinearLayout) findViewById(R.id.bottomTextLayout); pageNumLayout = (RelativeLayout) findViewById(R.id.page_num_layout); bottomPageNumberTV = (TextView) findViewById(R.id.bottomPageNumber); bottomPageTotalTV = (TextView) findViewById(R.id.pageNumberTotal); describeTV = (TextView) findViewById(R.id.describe); main_al = (RelativeLayout) findViewById(R.id.main_al); mProgressLayout = (ProgressBarView) findViewById(R.id.pbv_loading); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.ease_showvideo_activity); loadingLayout = (RelativeLayout) findViewById(R.id.loading_layout); progressBar = (ProgressBar) findViewById(R.id.progressBar); final EMMessage message = getIntent().getParcelableExtra("msg"); if (!(message.getBody() instanceof EMVideoMessageBody)) { Toast.makeText(EaseShowVideoActivity.this, "Unsupported message body", Toast.LENGTH_SHORT).show(); finish(); return; } EMVideoMessageBody messageBody = (EMVideoMessageBody)message.getBody(); localFilePath = messageBody.getLocalUrl(); if (localFilePath != null && new File(localFilePath).exists()) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(localFilePath)), "video/mp4"); startActivity(intent); finish(); } else { EMLog.d(TAG, "download remote video file"); downloadVideo(message); } }
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { // the content final RelativeLayout root = new RelativeLayout(getActivity()); root.setLayoutParams(new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); // creating the fullscreen dialog final Dialog dialog = new Dialog(getContext()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(root); if (dialog.getWindow() != null) { dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); dialog.getWindow().setLayout( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); } dialog.setCanceledOnTouchOutside(false); return dialog; }
private LinearLayout getPageBody() { llBody = new LinearLayout(getContext()); llBody.setId(2); int resId = getBitmapRes(activity, "edittext_back"); if (resId > 0) { llBody.setBackgroundResource(resId); } llBody.setOrientation(LinearLayout.VERTICAL); RelativeLayout.LayoutParams lpBody = new RelativeLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lpBody.addRule(RelativeLayout.ALIGN_LEFT, llTitle.getId()); lpBody.addRule(RelativeLayout.BELOW, llTitle.getId()); lpBody.addRule(RelativeLayout.ALIGN_RIGHT, llTitle.getId()); if (!dialogMode) { lpBody.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); } int dp_3 = dipToPx(getContext(), 3); lpBody.setMargins(dp_3, dp_3, dp_3, dp_3); llBody.setLayoutParams(lpBody); llBody.addView(getMainBody()); llBody.addView(getSep()); llBody.addView(getPlatformList()); return llBody; }
/** * Update a SeekBarPreference view with our current state * @param view */ protected void updateView(View view) { try { RelativeLayout layout = (RelativeLayout)view; mStatusText = (TextView)layout.findViewById(R.id.seekBarPrefValue); mStatusText.setText(String.valueOf(mCurrentValue)); mStatusText.setMinimumWidth(30); mSeekBar.setProgress(mCurrentValue - mMinValue); TextView unitsRight = (TextView)layout.findViewById(R.id.seekBarPrefUnitsRight); unitsRight.setText(mUnitsRight); TextView unitsLeft = (TextView)layout.findViewById(R.id.seekBarPrefUnitsLeft); unitsLeft.setText(mUnitsLeft); } catch(Exception e) { Log.e(TAG, "Error updating seek bar preference", e); } }
@Override public void addView(View child, int index, ViewGroup.LayoutParams params) { int childSum = this.getChildCount(); if(childSum > 1) { throw new IllegalStateException("can host only one direct child"); } else { super.addView(child, index, params); android.widget.RelativeLayout.LayoutParams paramsChild; if(childSum == 0) { if(child.getId() < 0) { child.setId(ID_CHILD); } paramsChild = (android.widget.RelativeLayout.LayoutParams)child.getLayoutParams(); paramsChild.addRule(12); child.setLayoutParams(paramsChild); } else if(childSum == 1) { paramsChild = (android.widget.RelativeLayout.LayoutParams)child.getLayoutParams(); paramsChild.addRule(2, ID_CHILD); child.setLayoutParams(paramsChild); } } }
private void initView() { // 设置SelectPicPopupWindow弹出窗体可点击 this.setFocusable(true); this.setOutsideTouchable(true); // 刷新状态 this.update(); // 设置SelectPicPopupWindow弹出窗体的宽 this.setWidth(RelativeLayout.LayoutParams.MATCH_PARENT); // 设置SelectPicPopupWindow弹出窗体的高 this.setHeight(RelativeLayout.LayoutParams.WRAP_CONTENT); //设置背景透明 setBackgroundDrawable(new ColorDrawable(0)); closeBtn = (ImageView) mainView.findViewById(R.id.closeBtn); closeBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dismiss(); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (isSignedIn()) { // sign in already, show main activity Intent intent = new Intent(this, MainActivity.class); startActivity(intent); finish(); return; } getSupportActionBar().hide(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { //透明状态栏 getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } setContentView(R.layout.activity_sign_in); RelativeLayout signin_btn = (RelativeLayout) findViewById(R.id.signin_btn); signin_btn.setOnClickListener(this); TextView github_btn = (TextView) findViewById(R.id.github_btn); github_btn.setOnClickListener(this); }
@Override public void run() { RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(w, h + HEIGHT_PADDING); params.leftMargin = x; params.topMargin = y; if (mTextEdit == null) { mTextEdit = new DummyEdit(getContext()); mLayout.addView(mTextEdit, params); } else { mTextEdit.setLayoutParams(params); } mTextEdit.setVisibility(View.VISIBLE); mTextEdit.requestFocus(); InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(mTextEdit, 0); }
private void initViews() { this.mPlayUpperLayout = (FrameLayout) findViewById(R.id.play_upper_layout); this.mPlayUpper = (FrameLayout) findViewById(2131361905); this.mPlayLower = (RelativeLayout) findViewById(R.id.play_lower); this.mPlayGestrue = (LetvPlayGestureLayout) findViewById(2131363812); this.mBtnGestureLock = (ImageView) findViewById(2131364024); this.mRect = new Rect(); if (this.mPlayType == 1) { this.mPlayFragment = new PlayLiveFragment(); } this.mPlayFragment.setIntent(getIntent()); if (this.mIsVr) { this.mPlayFragment.setSourceType(2); } else { this.mPlayFragment.setSourceType(this.mIsPanoramaVideo ? 1 : 0); } showFragmentIfNeeded(this.mPlayFragment, false); initSensor(); initController(); this.mLiveBarrageController = new LiveBarrageController(this, this.mPlayController.mLiveBarrageSentCallback, getSupportFragmentManager(), R.id.play_live_barrage_contain, 3); initWindowDirection(true); registerReceiver(); LeMessageManager.getInstance().dispatchMessage(this, new LeMessage(801)); initTask(); }
private void snapBack() { if (mMainWindows.getLayoutParams() instanceof RelativeLayout.LayoutParams) { final RelativeLayout.LayoutParams marginLayoutParams = (RelativeLayout.LayoutParams) mMainWindows.getLayoutParams(); final int startValueX = marginLayoutParams.leftMargin; final int startValueY = marginLayoutParams.topMargin; final int endValueX = 0; final int endValueY = 0; mMainWindows.clearAnimation(); Animation animation = new Animation() { @Override protected void applyTransformation(float interpolatedTime, Transformation t) { int leftMarginInterpolatedValue = (int) (startValueX + (endValueX - startValueX) * interpolatedTime); marginLayoutParams.leftMargin = leftMarginInterpolatedValue; int topMarginInterpolatedValue = (int) (startValueY + (endValueY - startValueY) * interpolatedTime); marginLayoutParams.topMargin = topMarginInterpolatedValue; mMainWindows.requestLayout(); } }; animation.setDuration(400); animation.setInterpolator(new DecelerateInterpolator()); mMainWindows.startAnimation(animation); } }
private void initViews() { RelativeLayout chatRLayout = (RelativeLayout) findViewById(R.id.seal_chat); RelativeLayout contactRLayout = (RelativeLayout) findViewById(R.id.seal_contact_list); RelativeLayout foundRLayout = (RelativeLayout) findViewById(R.id.seal_find); RelativeLayout mineRLayout = (RelativeLayout) findViewById(R.id.seal_me); mImageChats = (ImageView) findViewById(R.id.tab_img_chats); mImageContact = (ImageView) findViewById(R.id.tab_img_contact); mImageFind = (ImageView) findViewById(R.id.tab_img_find); mImageMe = (ImageView) findViewById(R.id.tab_img_me); mTextChats = (TextView) findViewById(R.id.tab_text_chats); mTextContact = (TextView) findViewById(R.id.tab_text_contact); mTextFind = (TextView) findViewById(R.id.tab_text_find); mTextMe = (TextView) findViewById(R.id.tab_text_me); mMineRed = (ImageView) findViewById(R.id.mine_red); moreImage = (ImageView) findViewById(R.id.seal_more); mSearchImageView = (ImageView) findViewById(R.id.ac_iv_search); chatRLayout.setOnClickListener(this); contactRLayout.setOnClickListener(this); foundRLayout.setOnClickListener(this); mineRLayout.setOnClickListener(this); moreImage.setOnClickListener(this); mSearchImageView.setOnClickListener(this); //接收MineFragment发现新版本信息发送的广播 显示 ”我“ 的Fragment中红色圆形图标 BroadcastManager.getInstance(mContext).addAction(MineFragment.SHOW_RED, new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { mMineRed.setVisibility(View.VISIBLE); } }); }
private void init() { flTitle = (FrameLayout) findViewById(R.id.fl_title); rlImageMessage = (RelativeLayout) findViewById(R.id.rl_image_message); ImageView ivBack = (ImageView) findViewById(R.id.iv_back); ivBack.setOnClickListener(this); ZoomRelativeLayout zoomParentLayout = (ZoomRelativeLayout) findViewById(R.id.rl_zoom_parent); DragPhotoView dragPhotoview = (DragPhotoView) findViewById(R.id.dragphotoview); dragPhotoview.setZoomParentView(zoomParentLayout); dragPhotoview.setOnViewTapListener(this); }
private void initSeekTextView(Context context) { mTextView = new TextView(context); mTextView.setBackgroundColor(getResources().getColor(R.color.panel_slide_background)); int padding = Util.getScreenWidth(context); mTextView.setPadding(padding / 50, padding / 50, padding / 50, padding / 50); LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.addRule(RelativeLayout.CENTER_IN_PARENT); addView(mTextView, lp); mTextView.setTextColor(getResources().getColor(android.R.color.white)); mTextView.setTextSize(14); mTextView.setVisibility(GONE); }
private void setupViews(View rootView) { progressBarLoadingData = (ProgressBar) rootView.findViewById(R.id.progressBar_loadingData); recyclerView_brands = (RecyclerView) rootView.findViewById(R.id.recyclerView_brands); relativeLayout_noInternet = (RelativeLayout) rootView.findViewById(R.id.relativeLayout_noInternet); relativeLayout_serverError = (RelativeLayout) rootView.findViewById(R.id.relativeLayout_serverError); relativeLayout_noData = (RelativeLayout) rootView.findViewById(R.id.relativeLayout_noBrands); setupRecyclerView(); }
private void initView() { this.mLeBoxName = (EditText) findViewById(R.id.lebox_main_et_nickname); this.mLeBoxStatus = (TextView) findViewById(R.id.lebox_main_status); this.mLeBoxShare = (Button) findViewById(R.id.btn_lebox_main_share); this.mLeBoxRename = (Button) findViewById(R.id.btn_lebox_main_rename); this.mLeBoxMyDownload = (RelativeLayout) findViewById(R.id.le_box_my_download); this.mLeBoxMyFollow = (RelativeLayout) findViewById(R.id.le_box_my_follow); this.mLeBoxIntroduce = (RelativeLayout) findViewById(R.id.le_box_introduce); this.mLeBoxBuy = (RelativeLayout) findViewById(R.id.le_box_buy); this.mLeBoxSettings = (RelativeLayout) findViewById(R.id.le_box_settings); this.mLeBoxRoomUpdate = (RelativeLayout) findViewById(R.id.le_box_room_update); this.mExitImageView = (ImageView) findViewById(R.id.common_nav_left); this.mScanImageView = (ImageView) findViewById(R.id.common_nav_right); int paddingPx = Util.dip2px(this, TitleBar.SHAREBTN_RIGHT_MARGIN); Logger.d(TAG, "---initView---paddingPx=" + paddingPx); this.mScanImageView.setPadding(paddingPx, paddingPx, paddingPx, paddingPx); this.mScanImageView.setImageResource(R.drawable.lebox_selector_navigation_right_scan); this.mScanImageView.setVisibility(0); this.mTitle = (TextView) findViewById(R.id.common_nav_title); this.mTitle.setText(R.string.lebox_main_navigation_title); this.mLeboxAdmin = (TextView) findViewById(R.id.lebox_main_admin); this.mLeBoxVersion = (TextView) findViewById(R.id.le_box_room_version); this.le_box_room_status = (ImageView) findViewById(R.id.le_box_room_status); this.mLeboxBtnGroup = (LinearLayout) findViewById(R.id.lebox_main_btn_layout); this.mLeBoxWifiConnect = (RelativeLayout) findViewById(R.id.lebox_main_valid_wifi); this.mPullToRefreshScrollView = (PullToRefreshScrollView) findViewById(R.id.lebox_main_pull_refresh_scrollview); this.mPullToRefreshScrollView.setMode(Mode.PULL_FROM_START); this.mleboxNetState = (RelativeLayout) findViewById(R.id.lebox_main_net_state); this.mLeboxCleanUser = (RelativeLayout) findViewById(R.id.lebox_main_clean_user); this.mLeboxWifiName = (TextView) findViewById(R.id.lebox_main_valid_wifi_name); }
@Override public void addHeaderView(final View headerView, final int nextHeaderPos) { LayoutParams newParams = new LayoutParams(headerView.getLayoutParams()); newParams.addRule(RelativeLayout.ALIGN_TOP); headerView.setLayoutParams(newParams); runJustBeforeBeingDrawn(headerView, new Runnable() { @Override public void run() { headerView.setTranslationY(calcTranslation(headerView.getHeight(), nextHeaderPos)); headerView.requestLayout(); } }); addView(headerView); removePrevHeaderView(); }
/** 动态适配编辑界面的高度 */ public void run() { int height = svContent.getChildAt(0).getHeight(); RelativeLayout.LayoutParams lp = ResHelper.forceCast(svContent.getLayoutParams()); if (height > maxBodyHeight && lp.height != maxBodyHeight) { lp.height = maxBodyHeight; svContent.setLayoutParams(lp); } else if (height < maxBodyHeight && lp.height == maxBodyHeight) { lp.height = LayoutParams.WRAP_CONTENT; svContent.setLayoutParams(lp); } }
/** * Handle Facebook */ public static void shareImageOnFace(Activity activity, RelativeLayout photoContent, View v) { // Cria conteudo para ser publicado no face SharePhoto photo = new SharePhoto.Builder().setBitmap(ImageUtil.drawBitmap(photoContent)).build(); SharePhotoContent content = new SharePhotoContent.Builder() .addPhoto(photo) .setShareHashtag(new ShareHashtag.Builder().setHashtag(HASHTAG).build()) .build(); new ShareDialog(activity).show(content); }
private void initView(Context context) { LayoutInflater.from(context).inflate(R.layout.view_customtitle, this, true); iv_titlebar_left = (ImageView) findViewById(R.id.iv_titlebar_left); iv_titlebar_right = (ImageView) findViewById(R.id.iv_titlebar_right); tv_titlebar_title = (TextView) findViewById(R.id.tv_titlebar_title); layout_titlebar_rootlayout = (RelativeLayout) findViewById(R.id.layout_titlebar_rootlayout); //设置背景颜色 layout_titlebar_rootlayout.setBackgroundColor(mColor); //设置标题文字颜色 tv_titlebar_title.setTextColor(mTextColor); setTitle(titlename); }
private void moveOffScreen() { Display display = getWindowManager().getDefaultDisplay(); int height = display.getHeight(); // deprecated int offset = (int)(height * 0.65); /* percent to move */ RelativeLayout.LayoutParams rlParams = (RelativeLayout.LayoutParams)mChart.getLayoutParams(); rlParams.setMargins(0, 0, 0, -offset); mChart.setLayoutParams(rlParams); }
/** * Constructor for listview * @param layout layout to get view objects */ public ViewHolder(View layout) { Typeface type = Typeface.createFromAsset(context.getAssets(),"simple.otf"); translationName = (TextView) layout.findViewById(R.id.textView5); translationInfo = (TextView) layout.findViewById(R.id.textView6); title = (TextView) layout.findViewById(R.id.title); transaltionStatus = (ImageView) layout.findViewById(R.id.Action); split = (LinearLayout) layout.findViewById(R.id.split); normal = (RelativeLayout)layout.findViewById(R.id.normal); downloading = (ProgressBar)layout.findViewById(R.id.downloading); translationName.setTypeface(type); translationInfo.setTypeface(type); }
private void changeDirectionBtn(String tag) { try { if (tag.equals("left")) { moveKeyboardRightLeft.setImageResource(R.mipmap.ic_keyboard_arrow_left_white_48dp); ((LayoutParams) surfaceContainer.getLayoutParams()).leftMargin = ((RelativeLayout) surfaceContainer.getParent()).getWidth() - surfaceContainer.getWidth(); ((LayoutParams) surfaceContainer.getLayoutParams()).rightMargin = 0; moveKeyboardRightLeft.setTag("right"); Common.startKeyboardContainerFromRight = true; //Speech it Common.defaultTextSpeech.speechText(context.getString(R.string.keyboard_is_top_right)); } else if (tag.equals("right")) { moveKeyboardRightLeft.setImageResource(R.mipmap.ic_keyboard_arrow_right_white_48dp); ((LayoutParams) surfaceContainer.getLayoutParams()).rightMargin = ((RelativeLayout) surfaceContainer.getParent()).getWidth() - surfaceContainer.getWidth(); ((LayoutParams) surfaceContainer.getLayoutParams()).leftMargin = 0; moveKeyboardRightLeft.setTag("left"); Common.startKeyboardContainerFromRight = false; //Speech it Common.defaultTextSpeech.speechText(context.getString(R.string.keyboard_is_top_left)); } surfaceContainer.removeAllViews(); brailleLayout.renderBrailleLayout(); requestLayout(); } catch (Exception e) { e.printStackTrace(); } }
private void setUser(final User user) { Log.v(TAG, "setUser: init"); UserAttacher.get((DrawerActivity) getActivity(), (RelativeLayout) mViewDetails.findViewById(R.id.userLayout), user) .setFullName((TextView) mViewDetails.findViewById(R.id.userName)) .setUsername((TextView) mViewDetails.findViewById(R.id.userUsername)) .setLevel((TextView) mViewDetails.findViewById(R.id.userLevel)) .setProgress((ProgressBar) mViewDetails.findViewById(R.id.userProgress)) .setAvatar((ImageView) mViewDetails.findViewById(R.id.userImage)); Log.v(TAG, "setUser finished"); }