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; }
public ItemBuilder addItemWithIconTitleSubtitle(int icon, String title, String subtitle) { view = inflater.inflate(R.layout.item_element_icon_title_subtitle, parent, false); ImageView iv = (ImageView) view.findViewById(R.id.iv_icon); iv.setImageResource(icon); TextView tv = (TextView) view.findViewById(R.id.tv_title); tv.setText(title); TextView tv2 = (TextView) view.findViewById(R.id.tv_subtitle); tv2.setText(subtitle); return this; }
public void onBtnNClicked(View view) { if (mVideoPreProcessing == null) { mVideoPreProcessing = new VideoPreProcessing(); } ImageView iv = (ImageView) view; Object showing = view.getTag(); if (showing != null && (Boolean) showing) { mVideoPreProcessing.enablePreProcessing(false); iv.setTag(null); iv.clearColorFilter(); } else { mVideoPreProcessing.enablePreProcessing(true); iv.setTag(true); iv.setColorFilter(getResources().getColor(R.color.agora_blue), PorterDuff.Mode.MULTIPLY); } }
public void onVoiceMuteClicked(View view) { log.info("onVoiceMuteClicked " + view + " " + mUidsList.size() + " video_status: " + mVideoMuted + " audio_status: " + mAudioMuted); if (mUidsList.size() == 0) { return; } RtcEngine rtcEngine = rtcEngine(); rtcEngine.muteLocalAudioStream(mAudioMuted = !mAudioMuted); ImageView iv = (ImageView) view; if (mAudioMuted) { iv.setColorFilter(getResources().getColor(R.color.agora_blue), PorterDuff.Mode.MULTIPLY); } else { iv.clearColorFilter(); } }
@Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.detail_layout); imageDetail = (ImageView)findViewById(R.id.image_detail); spot = (TextView)findViewById(R.id.spot_detail); time = (TextView)findViewById(R.id.time_detail); reward = (TextView)findViewById(R.id.reward_detail); username = (TextView)findViewById(R.id.username_detail); ps = (TextView)findViewById(R.id.ps_detail); imageDetail.setBackgroundResource(getIntent().getIntExtra("headId", 0)); spot.setText(getIntent().getStringExtra("spot")); time.setText(getIntent().getStringExtra("time")); reward.setText(getIntent().getStringExtra("reward")); username.setText(getIntent().getStringExtra("username")); ps.setText(getIntent().getStringExtra("ps")); }
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); xyPlot = (XYPlot) view.findViewById(R.id.accelerationGraph); badText = (TextView) view.findViewById(R.id.badText); normalText = (TextView) view.findViewById(R.id.normalText); goodText = (TextView) view.findViewById(R.id.goodText); perfectText = (TextView) view.findViewById(R.id.perfectText); distanceValueText = (TextView) view.findViewById(R.id.distanceValueText); speedText = (TextView) view.findViewById(R.id.speedText); speedValueText = (TextView) view.findViewById(R.id.speedValueText); bumpValueText = (TextView) view.findViewById(R.id.bumpValueText); badQualityText = (TextView) view.findViewById(R.id.badQualityText); normalQualityText = (TextView) view.findViewById(R.id.normalQualityText); goodQualityText = (TextView) view.findViewById(R.id.goodQualityText); perfectQualityText = (TextView) view.findViewById(R.id.perfectQualityText); deviceIndicatorAngleBtn = (ImageView) view.findViewById(R.id.wrong_angle_icon); gpsIndicatorBtn = (ImageView) view.findViewById(R.id.wrong_gps_icon); startMeasurementsBtn = (Button) view.findViewById(R.id.startMeasurementsBtn); roadIntervalValue = (TextView) view.findViewById(R.id.roadIntervalValue); roadIntervalText = (TextView) view.findViewById(R.id.roadIntervalText); recordStatusValue = (TextView) view.findViewById(R.id.recordStatusValue); itemsCntValueText = (TextView) view.findViewById(R.id.itemsCntValueText); intervalsCntValueText = (TextView) view.findViewById(R.id.intervalsCntValueText); initUI(); }
private void setupChildren() { topbar = new LinearLayout(getContext()); topbar.setOrientation(LinearLayout.HORIZONTAL); topbar.setClipChildren(false); topbar.setClipToPadding(false); addView(topbar, new LayoutParams(1)); buttonPast.setScaleType(ImageView.ScaleType.CENTER_INSIDE); topbar.addView(buttonPast, new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1)); title.setGravity(Gravity.CENTER); topbar.addView(title, new LinearLayout.LayoutParams( 0, LayoutParams.MATCH_PARENT, DEFAULT_DAYS_IN_WEEK - 2 )); buttonFuture.setScaleType(ImageView.ScaleType.CENTER_INSIDE); topbar.addView(buttonFuture, new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1)); pager.setId(R.id.mcv_pager); pager.setOffscreenPageLimit(1); addView(pager, new LayoutParams(calendarMode.visibleWeeksCount + DAY_NAMES_ROW)); }
private void showSupportersDialog() { final Dialog fullscreenDialog = new Dialog(this, R.style.DialogFullscreen); fullscreenDialog.setContentView(R.layout.dialog_supporters); Button logoutB = fullscreenDialog.findViewById(R.id.logout_b); ImageView img_dialog_fullscreen_close = fullscreenDialog.findViewById(R.id.close_iv); TextView collaborationTV = fullscreenDialog.findViewById(R.id.info_collaboration_tv); collaborationTV.setText(Html.fromHtml(getString(R.string.collaboration))); img_dialog_fullscreen_close.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { fullscreenDialog.dismiss(); } }); logoutB.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { saveToken(context, "HOME", null); Intent intent = new Intent(context, ActivitySplash.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); finish(); } }); fullscreenDialog.show(); }
/** * Instantiate a child view containing the user you following's habit and their individual completion status * @param groupPosition * @param childPosition * @param isExpanded * @param convertView * @param parent * @return */ @Override public View getChildView(int groupPosition, int childPosition, boolean isExpanded, View convertView, ViewGroup parent) { Habit habit = (Habit) getChild(groupPosition, childPosition); if(convertView == null) { convertView = mInflater.inflate(R.layout.item_following_habit, parent, false); } TextView titleView = (TextView) convertView.findViewById(R.id.following_habit_title); titleView.setText(habit.getTitle()); ImageView indicatorView = (ImageView) convertView.findViewById(R.id.following_habit_indicator); if (habit.getStatus() != null) { indicatorView.setColorFilter(habit.getStatus().getColor()); } return convertView; }
/** * 刷新选中的布局 */ private void updateSelectView() { mSelectContainer.removeAllViews(); if (mSelectedFriends.size() == 0) mHorizontalScrollView.setVisibility(View.GONE); else { mHorizontalScrollView.setVisibility(View.VISIBLE); for (final Author author : mSelectedFriends) { ImageView ivIcon = (ImageView) LayoutInflater.from(this) .inflate(R.layout.activity_main_select_friend_label_container_item, mSelectContainer, false); ivIcon.setTag(R.id.iv_show_icon, author); ivIcon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Author tag = (Author) v.getTag(R.id.iv_show_icon); onSelectIconClick(tag); mSelectContainer.removeView(v); } }); mSelectContainer.addView(ivIcon); Glide.with(this).load(author.getPortrait()).error(R.mipmap.widget_default_face).into(ivIcon); } } }
@Override public View getView(final int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = inflater.inflate(R.layout.view_list_musicrows, parent, false); ListView.LayoutParams layoutParams = new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT, ListView.LayoutParams.MATCH_PARENT); convertView.setLayoutParams(layoutParams); }; ImageView album = (ImageView) convertView.findViewById(R.id.view_album); album.setImageDrawable(context.getResources().getDrawable(android.R.drawable.ic_menu_report_image)); TextView title = (TextView) convertView.findViewById(R.id.view_title); TextView artist = (TextView) convertView.findViewById(R.id.view_artist); title.setText(list.get(position).title); artist.setText(list.get(position).artist + " - " + list.get(position).album + " - " + global.mMusicManager.convertToTime(list.get(position).length)); convertView.setTag(list.get(position).uid); MyAsyncTask myAsyncTask = new MyAsyncTask(); myAsyncTask.setImgView(album); myAsyncTask.execute(position + ""); return convertView; }
@Override public void setScale(float scale, float focalX, float focalY, boolean animate) { ImageView imageView = getImageView(); if (null != imageView) { // Check to see if the scale is within bounds if (scale < mMinScale || scale > mMaxScale) { Logger.i("Scale must be within the range of minScale and maxScale"); return; } if (animate) { imageView.post(new AnimatedZoomRunnable(getScale(), scale, focalX, focalY)); } else { mSuppMatrix.setScale(scale, scale, focalX, focalY); checkAndDisplayMatrix(); } } }
/** * Return row for each country */ @Override public View getView(int position, View convertView, ViewGroup parent) { View cellView = convertView; Cell cell; Country country = countries.get(position); if (convertView == null) { cell = new Cell(); cellView = inflater.inflate(R.layout.row, null); cell.textView = (TextView) cellView.findViewById(R.id.row_title); cell.imageView = (ImageView) cellView.findViewById(R.id.row_icon); cellView.setTag(cell); } else { cell = (Cell) cellView.getTag(); } cell.textView.setText(country.getName()); // Load drawable dynamically from country code String drawableName = "flag_" + country.getCode().toLowerCase(Locale.ENGLISH); cell.imageView.setImageResource(getResId(drawableName)); return cellView; }
private void initView(Context context) { View.inflate(context, R.layout.dialog_loading_tip, this); img_tip_logo = (ImageView) findViewById(R.id.img_tip_logo); progress = (ProgressBar) findViewById(R.id.progress); tv_tips = (TextView) findViewById(R.id.tv_tips); bt_operate = (Button) findViewById(R.id.bt_operate); //重新尝试 bt_operate.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { if(onReloadListener!=null){ onReloadListener.reload(); } } }); setVisibility(View.GONE); }
private void initView() { mRelativeLayout = (RelativeLayout) findViewById(R.id.rl_main); push_state_ll = (LinearLayout) findViewById(R.id.push_state_ll); settings = (ImageView) findViewById(R.id.iv_settings); settings.setOnClickListener(this); wx_user_name = (TextView) findViewById(R.id.wx_user_name_tv); wx_user_icon = (CircleImageView) findViewById(R.id.wx_user_icon_iv); mCountTimeView = (CountTimeView) findViewById(R.id.count_time_view); mRecorderButton = (ImageView) findViewById(R.id.iv_push); mRecorderButton.setOnClickListener(this); btn_pop_pro = (ImageView) findViewById(R.id.btn_pro); btn_pop_pro.setOnClickListener(this); btn_pop_talk = (ImageView) findViewById(R.id.btn_talk); btn_pop_talk.setOnClickListener(this); mTv_watch_person = (TextView) findViewById(R.id.tv_watch_person); mRelativeLayout.setOnTouchListener(this); }
public final ImageView getImageView() { ImageView imageView = null; if (null != mImageView) { imageView = mImageView.get(); } // If we don't have an ImageView, call cleanup() if (null == imageView) { cleanup(); throw new IllegalStateException( "ImageView no longer exists. You should not use this PhotoViewAttacher any more."); } return imageView; }
@Override public View onBind(final Context context, final MyBean data, final int position, @CardViewPager.TransformerMode int mode) { View view = View.inflate(context, R.layout.item, null); ImageView imageView = (ImageView) view.findViewById(R.id.image); ElasticCardView cardView = (ElasticCardView) view.findViewById(R.id.cardview); final boolean isCard = mode == CardViewPager.MODE_CARD; cardView.setPreventCornerOverlap(isCard); cardView.setUseCompatPadding(isCard); final String img = data.getImg(); Glide.with(context).load(img).into(imageView); view.setOnClickListener(v -> { Toast.makeText(context, "data:" + data + "position:" + position, Toast.LENGTH_SHORT).show(); TestActivity.start(context, img); }); return view; }
@Override public void setEnabled(boolean enabled) { super.setEnabled(enabled); for(int i=0;i<getChildCount();i++){ ImageView child = (ImageView) getChildAt(i); child.setEnabled(enabled); } }
@Override protected void onFinishInflate() { super.onFinishInflate(); mAllAppsHandle = (ImageView) findViewById(R.id.all_apps_handle); mAllAppsHandle.setImageDrawable(getCaretDrawable()); mAllAppsHandle.setOnTouchListener(mLauncher.getHapticFeedbackTouchListener()); mAllAppsHandle.setOnClickListener(mLauncher); mAllAppsHandle.setOnLongClickListener(mLauncher); mAllAppsHandle.setOnFocusChangeListener(mLauncher.mFocusHandler); mLauncher.setAllAppsButton(mAllAppsHandle); }
private void initView(View parent) { textView = (ImageView) parent.findViewById(R.id.textView); textView1 = (ImageView) parent.findViewById(R.id.textView1); title = (ImageView) parent.findViewById(R.id.title); title1 = (ImageView) parent.findViewById(R.id.title1); bifen1 = (TextView) parent.findViewById(R.id.bifen1); bifen2 = (TextView) parent.findViewById(R.id.bifen2); bifen3 = (TextView) parent.findViewById(R.id.bifen3); bifen = (TextView) parent.findViewById(R.id.bifen); zhudui = (FrameLayout) parent.findViewById(R.id.zhudui); kedui = (FrameLayout) parent.findViewById(R.id.kedui); bifenlayout = (FrameLayout) parent.findViewById(R.id.bifenlayout); bifen1layout = (RelativeLayout) parent.findViewById(R.id.bifen1layout); toolbarTitle = (RelativeLayout) parent.findViewById(R.id.toolbar_title); text_zhudui = (TextView) parent.findViewById(R.id.text_zhudui); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_profile); userId = getIntent().getIntExtra(EXTRA_USER_ID,0); mToolbar = (Toolbar) findViewById(R.id.activity_profile_toolbar); setSupportActionBar(mToolbar); getSupportActionBar().setDisplayShowTitleEnabled(false); mToolbar.setNavigationIcon(R.drawable.ic_action_back); mAvatarImageView = (ImageView) findViewById(R.id.activity_profile_avatar); mNameTextView = (TextView) findViewById(R.id.activity_profile_name); mBioTextView = (TextView) findViewById(R.id.activity_profile_bio); mValueTextView = (TextView) findViewById(R.id.activity_profile_value); mLocationTextView = (TextView) findViewById(R.id.activity_profile_location); mEditCardView = (CardView) findViewById(R.id.activity_profile_cv_edit); mEditButton = (Button) findViewById(R.id.activity_profile_button_edit); mRecyclerView = (RecyclerView) findViewById(R.id.activity_profile_recycler_view); mRecyclerView.setLayoutManager(new LinearLayoutManager(this)); mRecyclerView.setAdapter(new NewAdapter(new ArrayList<RantItem>())); getData(); }
private void initialize(AttributeSet attrs) { inflate(getContext(), R.layout.alert_view, this); approvalIndicator = (ImageView) findViewById(R.id.pending_approval_indicator); failedIndicator = (ImageView) findViewById(R.id.sms_failed_indicator); if (attrs != null) { TypedArray typedArray = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.AlertView, 0, 0); boolean useSmallIcon = typedArray.getBoolean(R.styleable.AlertView_useSmallIcon, false); typedArray.recycle(); if (useSmallIcon) { failedIndicator.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_error_red_18dp)); } } }
public CheckItemView(Context context, boolean right) { super(context); mContext = context; mCheckedView = new ImageView(mContext); mCheckedView.setImageDrawable(QMUIResHelper.getAttrDrawable(context, R.attr.qmui_s_checkbox)); mCheckedView.setId(QMUIViewHelper.generateViewId()); LayoutParams checkLp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); checkLp.addRule(CENTER_VERTICAL, TRUE); if(right){ checkLp.addRule(ALIGN_PARENT_RIGHT, TRUE); checkLp.leftMargin = QMUIResHelper.getAttrDimen(mContext, R.attr.qmui_dialog_menu_item_check_icon_margin_horizontal); }else{ checkLp.addRule(ALIGN_PARENT_LEFT, TRUE); checkLp.rightMargin =QMUIResHelper.getAttrDimen(mContext, R.attr.qmui_dialog_menu_item_check_icon_margin_horizontal); } addView(mCheckedView,checkLp); mTextView = createItemTextView(mContext); LayoutParams tvLp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); if(right){ tvLp.addRule(LEFT_OF, mCheckedView.getId()); }else{ tvLp.addRule(RIGHT_OF, mCheckedView.getId()); } addView(mTextView,tvLp); }
private void setIntentByViewGroup(RemoteViews remoteViews, ViewGroup viewGroup, List<RectInfo> list) { int count = viewGroup.getChildCount(); Rect p = new Rect(); viewGroup.getHitRect(p); for (int i = 0; i < count; i++) { View v = viewGroup.getChildAt(i); if (v instanceof ViewGroup) { // linearlayout setIntentByViewGroup(remoteViews, (ViewGroup) v, list); } else if (v instanceof TextView || v instanceof ImageView) { // textview Rect rect = getRect(v); RectInfo next = findIntent(rect, list); if (next != null) { // VLog.d(TAG, next.rect+":setPendIntent:"+i); // remoteViews.setImageViewBitmap(v.getId(), next.testBg); remoteViews.setOnClickPendingIntent(v.getId(), next.mPendingIntent); } } } }
private void setHeaderViewData() { ImageLoader.loadImage(getActivity(), mTopicBean.getNewIcon(), (ImageView) mHeaderView.findViewById(R.id.game_header_iv)); ImageLoader.loadImage(getActivity(), mTopicBean.getNewIconBgImg(), (ImageView) mHeaderView.findViewById(R.id.game_header_bg_iv)); ((TextView) mHeaderView.findViewById(R.id.game_header_title_tv)).setText(mTopicBean.getTopicName()); ((TextView) mHeaderView.findViewById(R.id.game_header_des_tv)).setText(mTopicBean.getTopicDescription()); ((TextView) mHeaderView.findViewById(R.id.game_header_fouce_num_tv)).setText(mTopicBean.getFollowUserCount() + " 人关注"); mHeaderFocuseIv.setBackgroundResource(R.drawable.border_red); mHeaderFocuseIv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mPresenter.changeFocuseState(); } }); }
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.watch_detail_info_layout); mPosition = getIntent().getIntExtra("position", 0); Toolbar toolbar = (Toolbar) findViewById(R.id.infoToolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); mTitleImage = (ImageView)findViewById(R.id.infoTitleImage); mIntroImage_1 = (ImageView)findViewById(R.id.imageIntro_1); mIntroImage_2 = (ImageView)findViewById(R.id.imageIntro_2); mIntroImage_3 = (ImageView)findViewById(R.id.imageIntro_3); setImagesRes(mTitleImage, mIntroImage_1, mIntroImage_2, mIntroImage_3); }
public ThumbnailView(final Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); inflate(context, R.layout.thumbnail_view, this); this.radius = getResources().getDimensionPixelSize(R.dimen.message_bubble_corner_radius); this.image = (ImageView) findViewById(R.id.thumbnail_image); this.playOverlay = (ImageView) findViewById(R.id.play_overlay); super.setOnClickListener(new ThumbnailClickDispatcher()); if (attrs != null) { TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.ThumbnailView, 0, 0); backgroundColorHint = typedArray.getColor(R.styleable.ThumbnailView_backgroundColorHint, Color.BLACK); typedArray.recycle(); } }
public final void update() { ImageView imageView = getImageView(); if (null != imageView) { if (mZoomEnabled) { // Make sure we using MATRIX Scale Type setImageViewScaleTypeMatrix(imageView); // Update the base matrix using the current drawable updateBaseMatrix(imageView.getDrawable()); } else { // Reset the Matrix... resetMatrix(); } } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_batch_file_compress_test); mOriginImg1 = (ImageView) findViewById(R.id.img_origin1); mOriginImg2 = (ImageView) findViewById(R.id.img_origin2); mOriginImg3 = (ImageView) findViewById(R.id.img_origin3); mOriginImg4 = (ImageView) findViewById(R.id.img_origin4); mCompressImg1 = (ImageView) findViewById(R.id.img_compress1); mCompressImg2 = (ImageView) findViewById(R.id.img_compress2); mCompressImg3 = (ImageView) findViewById(R.id.img_compress3); mCompressImg4 = (ImageView) findViewById(R.id.img_compress4); mOriginTv = (TextView) findViewById(R.id.tv_origin); mCompressTv = (TextView) findViewById(R.id.tv_compress); }
public void setup(OnChildFocusListener focusListener, ImageView cursor, ControllerParent<?> controller, onGetPinsView onGetPinsListener) { this.focusListener = focusListener; this.cursor = cursor; this.controller = controller; this.onGetPinsListener = onGetPinsListener; currentIndex = -1; currentTag = null; isOnglobalCalled = false; childrenRects = new ArrayList<PinData>(); getViewTreeObserver().addOnGlobalLayoutListener( new OnGlobalLayoutListener() { @Override public void onGlobalLayout() { if (!isOnglobalCalled && (childrenRects == null || childrenRects .size() == 0)) { childrenRects = new ArrayList<PinsColumnContainer.PinData>(); loadRects(PinsColumnContainer.this); PinsColumnContainer.this.onGetPinsListener .onPinsDrawn(); isOnglobalCalled = true; } } }); }
public PhotoHolder(View v, App app) { super(v); mApp = app; mItemImage = (ImageView) v.findViewById(R.id.item_image); v.setOnClickListener(this); }
@Override public Object instantiateItem(ViewGroup container, final int position) { RelativeLayout layout = new RelativeLayout(container.getContext()); ImageView imageView = new ImageView(container.getContext()); imageView.setScaleType(ImageView.ScaleType.FIT_XY); layout.addView(imageView, new ViewGroup.LayoutParams(-1, -1)); initImageView(layout, imageView, position); container.addView(layout, new ViewGroup.LayoutParams(width, height)); return layout; }
public AnchorHotViewHolder(final View itemView) { super(itemView); pic = (ImageView) itemView.findViewById(R.id.img_layout_project_sorting_item_pic); tvName = (TextView) itemView.findViewById(R.id.tv_item_project_list_name); tvRound = (TextView) itemView.findViewById(R.id.tv_item_project_list_round); tvStatus = (TextView) itemView.findViewById(R.id.tv_status); tvCity = (TextView) itemView.findViewById(R.id.tv_item_project_list_city); tvRemark = (TextView) itemView.findViewById(R.id.tv_item_project_list_remark); tvCommentCount = (TextView) itemView.findViewById(R.id.tv_project_sorting_comments); tv_project_sorting_collection = (TextView) itemView.findViewById(R.id.tv_project_sorting_collection); }
@Override protected void onInitDefaultValues() { super.onInitDefaultValues(); icon = new ImageView(getContext()); iconSize = 24; sizeRadius = 28; rippleSpeed = 3; rippleSize = 5; minWidth = sizeRadius * 2;// 56dp minHeight = sizeRadius * 2;// 56dp backgroundResId = R.drawable.background_button_float; }
public void initView() { nameView = (TextView)itemView.findViewById(R.id.tv_friend_name); avatarView = (ImageView)itemView.findViewById(R.id.img_friend_avatar); itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getContext(), LCIMConversationActivity.class); intent.putExtra(LCIMConstants.PEER_ID, lcChatKitUser.getUserId()); getContext().startActivity(intent); } }); }
@Override public void realOnBindViewHolder(RecyclerViewHolder holder, int position) { ImageView image = holder.findViewById(R.id.image); TextView nameTV = holder.findViewById(R.id.name); TextView descTV = holder.findViewById(R.id.desc); TextView picnumTV = holder.findViewById(R.id.picnum); FileInfo info = realGetItem(position); nameTV.setText(info.getName()); descTV.setText(getString(R.string.size_1, info.getDisplaySize())); picnumTV.setText(getString(R.string.file_count_1, info.getFileCount())); }
@Override public void doOnViewCreated(View v, @Nullable Bundle savedInstanceState) { musicFileName = (TextView) v.findViewById(R.id.playingMusic); seekBar = (SeekBar) v.findViewById(R.id.seekBar); playingBtn = (ImageView) v.findViewById(R.id.playingBtn); playingStatus = (TextView) v.findViewById(R.id.playingStatus); hasSettings = true; }
private View getAddView() { mAddImageView=new ImageView(this.getContext()); LayoutParams param=getLayoutParams((getMeasuredWidth()-20)/4,getMeasuredHeight()); param.weight=1; param.gravity= Gravity.CENTER; mAddImageView.setLayoutParams(param); mDeleteImageView.setScaleType(ImageView.ScaleType.CENTER); setBackgroundDrawable(mAddImageView, addDrawable); return mAddImageView; }
@BindingAdapter(value = {"imageUrl", "placeHolder", "error"}, requireAll = false) /** * 不支持mipmap下的图片 */ public static void loadImage(ImageView imageView, String url, Drawable holderDrawable, Drawable errorDrawable) { Glide.with(imageView.getContext()) .load(url) .apply(GlideRequestOption.getRequestOptions().placeholder(holderDrawable) .error(errorDrawable)) .into(imageView); }
public void setImageDrawableOnUiThread(final ImageView view, final Drawable drawable) { this.runOnUiThread(new Runnable() { @Override public void run() { if (view != null && view.getVisibility() != View.GONE) { view.setImageDrawable(drawable); } } }); }