List of usage examples for android.widget ImageView setLayoutParams
public void setLayoutParams(ViewGroup.LayoutParams params)
From source file:app.wenya.sketchbookpro.ui.view.looppager.IconPageIndicator.java
public void notifyDataSetChanged() { mIconsLayout.removeAllViews();/*w w w .j a va 2 s. c om*/ IconPagerAdapter iconAdapter = (IconPagerAdapter) mViewPager.getAdapter(); int count = iconAdapter.getPagerCount(); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); lp.leftMargin = 10; lp.rightMargin = 10; for (int i = 0; i < count; i++) { ImageView view = new ImageView(getContext(), null, R.attr.vpiIconPageIndicatorStyle); view.setImageResource(iconAdapter.getIconResId(i)); view.setLayoutParams(lp); mIconsLayout.addView(view); } if (mSelectedIndex > count) { mSelectedIndex = count - 1; } setCurrentItem(mSelectedIndex); requestLayout(); }
From source file:be.ac.ucl.lfsab1509.bouboule.MyLevelFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.myfragment_layout, container, false); /* Set the locks and co */ if (mCurrentPage <= lastUnlockedWorld) { ((ImageView) v.findViewById(R.id.levelimage)).setImageResource((getResources() .getIdentifier("world" + mCurrentPage, "drawable", getActivity().getPackageName()))); // or (R.drawable.world1 + mCurrentPage - 1) but maybe dangerous /* Hack to set the right size on small devices */ ImageView imageLvl = (ImageView) v.findViewById(R.id.levelimage); LayoutParams params = (LayoutParams) imageLvl.getLayoutParams(); params.width = getDisplayVector().x / 2; imageLvl.setLayoutParams(params); ImageButton play = (ImageButton) v.findViewById(R.id.play); /* Activate the play and desactivate the lock */ play.setOnClickListener(clickListener); ImageButton lock = (ImageButton) v.findViewById(R.id.lock); lock.setVisibility(View.INVISIBLE); } else {/*w w w . j a v a 2 s .c o m*/ ImageButton play = (ImageButton) v.findViewById(R.id.play); play.setVisibility(View.INVISIBLE); //imageLvl.setColorFilter(new LightingColorFilter(Color.GRAY, 1)); } return v; }
From source file:org.alfresco.mobile.android.application.fragments.node.comment.CommentsFragment.java
@Override protected void prepareEmptyInitialView(View ev, ImageView emptyImageView, TextView firstEmptyMessage, TextView secondEmptyMessage) {//from w w w .j av a2s . c om emptyImageView.setLayoutParams(DisplayUtils.resizeLayout(getActivity(), 275, 275)); emptyImageView.setImageResource(R.drawable.alfresco_background_logo); firstEmptyMessage.setVisibility(View.GONE); secondEmptyMessage.setVisibility(View.GONE); }
From source file:org.alfresco.mobile.android.application.fragments.node.comment.CommentsFragment.java
protected void prepareEmptyView(View ev, ImageView emptyImageView, TextView firstEmptyMessage, TextView secondEmptyMessage) {/*from w w w .j a v a 2 s.com*/ emptyImageView.setLayoutParams(DisplayUtils.resizeLayout(getActivity(), 275, 275)); emptyImageView.setImageResource(R.drawable.alfresco_background_logo); firstEmptyMessage.setVisibility(View.VISIBLE); firstEmptyMessage.setText(R.string.empty_comment); secondEmptyMessage.setVisibility(View.GONE); }
From source file:com.cmput301.recipebot.ui.adapters.ImagePagerAdapter.java
@Override public Object instantiateItem(ViewGroup view, int position) { final ImageView imageView = new ImageView(mContext); String image = mImages.get(position); ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); imageView.setLayoutParams(lp); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); if (image.startsWith("http")) { ImageLoader.getInstance().displayImage(image, imageView); } else {/*from w w w.j a v a 2 s .com*/ new BitmapUtils.DecodeBitmapTask(imageView).execute(image); } ((ViewPager) view).addView(imageView, 0); return imageView; }
From source file:org.alfresco.mobile.android.application.fragments.workflow.process.ProcessesFragment.java
@Override protected void prepareEmptyView(View ev, ImageView emptyImageView, TextView firstEmptyMessage, TextView secondEmptyMessage) {/*from ww w. jav a 2 s . co m*/ emptyImageView.setLayoutParams(DisplayUtils.resizeLayout(getActivity(), 275, 275)); emptyImageView.setImageResource(R.drawable.ic_empty_tasks); firstEmptyMessage.setText(R.string.tasks_list_empty_title); secondEmptyMessage.setVisibility(View.VISIBLE); secondEmptyMessage.setText(R.string.tasks_list_empty_description); }
From source file:eu.geopaparazzi.library.forms.views.GPictureView.java
public void refresh(final Context context) throws Exception { log("Entering refresh...."); if (_value != null && _value.length() > 0) { String[] imageSplit = _value.split(IMAGE_ID_SEPARATOR); log("Handling images: " + _value); IImagesDbHelper imagesDbHelper = DefaultHelperClasses.getDefaulfImageHelper(); for (String imageId : imageSplit) { log("img: " + imageId); if (imageId.length() == 0) { continue; }//from w w w. j av a2s . c o m long imageIdLong; try { imageIdLong = Long.parseLong(imageId); } catch (Exception e) { continue; } if (addedImages.contains(imageId.trim())) { continue; } byte[] imageThumbnail = imagesDbHelper.getImageThumbnail(imageIdLong); Bitmap thumbnail = ImageUtilities.getImageFromImageData(imageThumbnail); ImageView imageView = new ImageView(context); imageView.setLayoutParams(new LinearLayout.LayoutParams(102, 102)); imageView.setPadding(5, 5, 5, 5); imageView.setImageBitmap(thumbnail); imageView.setBackgroundDrawable(getResources().getDrawable(R.drawable.border_black_1px)); // imageView.setOnClickListener(new View.OnClickListener() { // public void onClick(View v) { // /* // * open in markers to edit it // */ // // FIXME // MarkersUtilities.launchOnImage(context, image); // // Intent intent = new Intent(); // // intent.setAction(android.content.Intent.ACTION_VIEW); // // intent.setDataAndType(Uri.fromFile(image), "image/*"); //$NON-NLS-1$ // // context.startActivity(intent); // } // }); log("Creating thumb and adding it: " + imageId); imageLayout.addView(imageView); imageLayout.invalidate(); addedImages.add(imageId); } if (addedImages.size() > 0) { StringBuilder sb = new StringBuilder(); for (String imagePath : addedImages) { sb.append(IMAGE_ID_SEPARATOR).append(imagePath); } _value = sb.substring(1); log("New img ids: " + _value); } log("Exiting refresh...."); } }
From source file:com.almeida.matheus.androidslidingtabmaterialdesigner.Components.SlidingTabLayout.java
/** * Create a default view to be used for tabs. This is called if a custom tab view is not set via * {@link (int, int)}./*from w ww .j a v a2 s . c om*/ */ protected ImageView createDefaultTabView(Context context) { ImageView iconTab = new ImageView(context); iconTab.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); iconTab.setBackgroundResource(outValue.resourceId); int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); iconTab.setPadding(padding, padding, padding, padding); return iconTab; }
From source file:com.angelatech.yeyelive.view.PeriscopeLayout.java
public void addHeart() { ImageView imageView = new ImageView(getContext()); //?//ww w. ja va2 s . c o m imageView.setImageDrawable(drawables[random.nextInt(7)]); imageView.setLayoutParams(lp); addView(imageView); Animator set = getAnimator(imageView); set.addListener(new AnimEndListener(imageView)); set.start(); }
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 ww . j ava2s.c o m*/ return imageView; }