List of usage examples for android.widget ImageView ImageView
public ImageView(Context context)
From source file:com.pax.view.MenuPage.java
public void initPageIndicator() { if (itemList.size() % maxItemNumPerPage == 0) { numPages = itemList.size() / maxItemNumPerPage; } else {//ww w . j av a 2 s .c o m numPages = itemList.size() / maxItemNumPerPage + 1; } if (0 < numPages) { pageIndicatorLayout.removeAllViews(); if (1 == numPages) { pageIndicatorLayout.setVisibility(View.GONE); } else if (1 < numPages) { pageIndicatorLayout.setVisibility(View.VISIBLE); for (int j = 0; j < numPages; j++) { ImageView image = new ImageView(context); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(20, 20); // dot params.setMargins(10, 0, 10, 0); image.setImageResource(R.drawable.guide_dot_normal); pageIndicatorLayout.addView(image, params); } } } if (numPages != 1) { pageIndicator = new ImageView[numPages]; for (int i = 0; i < numPages; i++) { pageIndicator[i] = (ImageView) pageIndicatorLayout.getChildAt(i); } currentPageIndex = 0; pageIndicator[currentPageIndex].setImageResource(R.drawable.guide_dot_select); mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int index) { setCurrentIndicator(index); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } }); } }
From source file:com.tundem.alternativefindr.ApplicationActivity.java
public void init_application(View v) { WebImageView alternative_icon = ((WebImageView) v.findViewById(R.id.alternative_icon)); TextView alternative_votes = ((TextView) v.findViewById(R.id.alternative_votes)); TextView alternative_name = ((TextView) v.findViewById(R.id.alternative_name)); TextView alternative_license = ((TextView) v.findViewById(R.id.alternative_license)); LinearLayout alternative_platforms = ((LinearLayout) v.findViewById(R.id.alternative_platforms_container)); //TextView alternative_description = ((TextView) v.findViewById(R.id.alternative_description)); /* Set ImageView */ alternative_icon.setImageUrl(mApplication.getIconUrl()); /* Set Texts */ alternative_votes.setText(String.valueOf(mApplication.getVotes()) + "\nVotes"); alternative_name.setText(mApplication.getName()); alternative_license.setText(mApplication.getLicense()); //alternative_description.setText(application.getShortDescription()); if (mApplication.getPlatforms() != null) { List<Integer> resIds = new LinkedList<Integer>(); for (String s : mApplication.getPlatforms()) { if (!TextUtils.isEmpty(s)) { int resId = getResId(s.toLowerCase()); if (!resIds.contains(resId) && resId != -1) resIds.add(resId);// w w w. ja v a 2 s. c o m } } for (Integer resId : resIds) { ImageView iv = new ImageView(this); iv.setScaleType(ScaleType.FIT_CENTER); float sizeInDip = 18f; int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, sizeInDip, this.getResources().getDisplayMetrics()); LayoutParams lp = new LayoutParams(padding, padding); iv.setLayoutParams(lp); iv.setImageResource(resId); alternative_platforms.addView(iv); } } }
From source file:mobisocial.musubi.objects.FileObj.java
@Override public View createView(Context context, ViewGroup frame) { LinearLayout container = new LinearLayout(context); container.setLayoutParams(CommonLayouts.FULL_WIDTH); container.setOrientation(LinearLayout.HORIZONTAL); container.setGravity(Gravity.CENTER); ImageView imageView = new ImageView(context); imageView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)); TextView valueTV = new TextView(context); valueTV.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); valueTV.setGravity(Gravity.BOTTOM | Gravity.LEFT); valueTV.setPadding(4, 0, 0, 0);/*from www.jav a2 s. c om*/ container.addView(imageView); container.addView(valueTV); return container; }
From source file:com.tony.selene.sliding.AbSlidingPlayView.java
/** * ./* w w w .j a va 2s. c o m*/ */ public void creatIndex() { // ? navLinearLayout.removeAllViews(); mNavLayoutParent.setHorizontalGravity(navHorizontalGravity); navLinearLayout.setGravity(Gravity.CENTER); navLinearLayout.setVisibility(View.VISIBLE); count = mListViews.size(); navLayoutParams.setMargins(5, 5, 5, 5); navLayoutParams.width = 15; navLayoutParams.height = 15; for (int j = 0; j < count; j++) { ImageView imageView = new ImageView(context); imageView.setLayoutParams(navLayoutParams); if (j == 0) { imageView.setImageDrawable(displayDrawable); } else { imageView.setImageDrawable(hideDrawable); } AbViewUtil.scaleView(imageView); navLinearLayout.addView(imageView, j); } }
From source file:com.google.reviewit.AddReviewerFragment.java
private void addReviewerRow(TableLayout tl, AccountInfo reviewer) { TableRow tr = new TableRow(getContext()); tr.setLayoutParams(matchAndWrapTableRowLayout()); ImageView avatar = new ImageView(getContext()); TableRow.LayoutParams layoutParams = new TableRow.LayoutParams(widgetUtil.dpToPx(20), widgetUtil.dpToPx(20));/* w w w.j a va 2s .c o m*/ layoutParams.setMargins(0, 0, widgetUtil.dpToPx(5), widgetUtil.dpToPx(2)); avatar.setLayoutParams(layoutParams); WidgetUtil.displayAvatar(getApp(), reviewer, avatar); tr.addView(avatar); TextView reviewerName = new TextView(getContext()); reviewerName.setLayoutParams(wrapTableRowLayout()); reviewerName.setText(FormatUtil.format(reviewer)); tr.addView(reviewerName); tl.addView(tr, matchAndWrapTableLayout()); }
From source file:com.ab.view.sliding.AbSlidingPlayView.java
/** * ./*from w ww . jav a2 s . c o m*/ */ public void creatIndex() { //? navLinearLayout.removeAllViews(); mNavLayoutParent.setHorizontalGravity(navHorizontalGravity); navLinearLayout.setGravity(Gravity.CENTER); navLinearLayout.setVisibility(View.VISIBLE); count = mListViews.size(); navLayoutParams.setMargins(5, 5, 5, 5); for (int j = 0; j < count; j++) { ImageView imageView = new ImageView(context); imageView.setLayoutParams(navLayoutParams); if (j == 0) { imageView.setImageBitmap(displayImage); } else { imageView.setImageBitmap(hideImage); } navLinearLayout.addView(imageView, j); } }
From source file:com.snypir.callback.view.SlidingTabLayout.java
/** * 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)}./*from w ww . ja v a 2 s .co m*/ */ protected ImageView createDefaultTabView(Context context) { ImageView imageView = new ImageView(context); imageView.setAdjustViewBounds(true); int padding = (int) (TAB_VIEW_PADDING_VERTICAL_DIPS * getResources().getDisplayMetrics().density); imageView.setPadding(padding, padding, padding, padding); return imageView; }
From source file:com.example.khaalijeb.newlistview_module.SlidingTabLayout.java
/** * 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)}./* w w w . jav a2 s . co m*/ */ protected ImageView createDefaultImageView(Context context) { ImageView imageView = new ImageView(context); int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); imageView.setPadding(padding, padding, padding, padding); // int width = (int) (getResources().getDisplayMetrics().widthPixels / mViewPager.getAdapter().getCount()); // imageView.setMinimumWidth(width); imageView.setLayoutParams( new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1.0f)); /* WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); Point size = new Point(); display.getSize(size); imageView.setMaxWidth(size.x /4); */ return imageView; }
From source file:com.lxh.util.pullview.AbSlidingPlayView.java
/** * ./*from ww w.j a v a 2s .co m*/ */ public void creatIndex() { // ? navLinearLayout.removeAllViews(); mNavLayoutParent.setHorizontalGravity(navHorizontalGravity); navLinearLayout.setGravity(Gravity.CENTER); navLinearLayout.setVisibility(View.VISIBLE); count = mListViews.size(); navLayoutParams.setMargins(5, 5, 5, 5); for (int j = 0; j < count; j++) { ImageView imageView = new ImageView(context); imageView.setLayoutParams(navLayoutParams); if (j == 0) { imageView.setImageBitmap(displayImage); } else { imageView.setImageBitmap(hideImage); } navLinearLayout.addView(imageView, j); } }
From source file:com.surinov.alexander.wallet2wallet.views.SlidingTabLayout.java
private ImageView crateDefaultImageView(Context context) { ImageView imageView = new ImageView(context); imageView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); imageView.setPadding(padding, padding, padding, padding); imageView.setClickable(true);/* w w w. j a va 2 s. c o m*/ return imageView; }