List of usage examples for android.widget ImageView setPadding
public void setPadding(int left, int top, int right, int bottom)
From source file:mobisocial.musubi.objects.PictureObj.java
@Override public View createView(Context context, ViewGroup parent) { LinearLayout frame = new LinearLayout(context); frame.setLayoutParams(CommonLayouts.FULL_WIDTH); frame.setOrientation(LinearLayout.VERTICAL); ImageView imageView = new ImageView(context); imageView.setBackgroundResource(android.R.drawable.picture_frame); imageView.setPadding(6, 4, 8, 9); frame.addView(imageView);/*from w ww .ja v a 2s . com*/ TextView textView = new TextView(context); frame.addView(textView); return frame; }
From source file:at.wada811.android.dialogfragments.sample.alertdialogfragment.AlertDialogFragmentExamplesFragment.java
@Override public DialogFragmentCallback getDialogFragmentCallback() { return new SimpleDialogFragmentCallback() { @Override// w w w . ja v a 2 s . co m public void onShow(DialogFragmentInterface dialog) { String text = "onShow"; Log.v(dialog.getTag(), text); Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show(); } @Override public void onCancel(DialogFragmentInterface dialog) { String text = "onCancel"; Log.v(dialog.getTag(), text); Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show(); } @Override public void onDismiss(DialogFragmentInterface dialog) { String text = "onDismiss"; Log.v(dialog.getTag(), text); Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show(); } @Override public void onClickPositive(DialogFragmentInterface dialog) { String text = "onClickPositive"; Log.v(dialog.getTag(), text); Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show(); } @Override public void onClickNeutral(DialogFragmentInterface dialog) { String text = "onClickNeutral"; Log.v(dialog.getTag(), text); Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show(); } @Override public void onClickNegative(DialogFragmentInterface dialog) { String text = "onClickNegative"; Log.v(dialog.getTag(), text); Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show(); } @Override public boolean onKey(DialogFragmentInterface dialog, int keyCode, KeyEvent event) { String text = "onKey[keyCode: " + keyCode + ", KeyEvent: " + event + "]"; Log.v(dialog.getTag(), text); Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show(); return false; } @Override public void onItemClick(DialogFragmentInterface dialog, int position) { Bundle extra = dialog.getExtra(); String[] items = extra.getStringArray("items"); String text = "onItemClick[position: " + position + ", item: " + items[position] + "]"; Log.v(dialog.getTag(), text); Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show(); } @Override public ListAdapter getAdapter(DialogFragmentInterface dialog) { String[] items = new String[] { AlertDialog.class.getSimpleName(), CharacterPickerDialog.class.getSimpleName(), ProgressDialog.class.getSimpleName(), DatePickerDialog.class.getSimpleName(), TimePickerDialog.class.getSimpleName(), }; Bundle extra = new Bundle(); extra.putStringArray("items", items); dialog.setExtra(extra); return new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, items); } @Override public void onSingleChoiceClick(DialogFragmentInterface dialog, int position) { Bundle extra = dialog.getExtra(); String[] items = extra.getStringArray("items"); String text = "onItemClick[position: " + position + ", item: " + items[position] + "]"; Log.v(dialog.getTag(), text); Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show(); } @Override public void onMultiChoiceClick(DialogFragmentInterface dialog, int position, boolean isChecked) { Bundle extra = dialog.getExtra(); String[] items = extra.getStringArray("items"); String text = "onItemClick[position: " + position + ", item: " + items[position] + ", isChecked: " + isChecked + "]"; Log.v(dialog.getTag(), text); Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT).show(); } @Override public View getCustomTitle(DialogFragmentInterface dialog) { TextView titleView = new TextView(getActivity()); titleView.setText(dialog.getTag()); titleView.setPadding(0, 24, 0, 24); titleView.setGravity(Gravity.CENTER); titleView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); return titleView; } @Override public View getView(DialogFragmentInterface dialog) { ImageView imageView = new ImageView(getActivity()); imageView.setImageResource(R.drawable.ic_launcher); imageView.setPadding(0, 24, 0, 24); return imageView; } }; }
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 ww w .java 2s. 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:org.telegram.ui.LoginActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.login_layout); ApplicationLoader.applicationContext = this.getApplicationContext(); getSupportActionBar().setLogo(R.drawable.ab_icon_fixed2); getSupportActionBar().show();/* w ww. ja v a2 s .co m*/ ImageView view = (ImageView) findViewById(16908332); if (view == null) { view = (ImageView) findViewById(R.id.home); } if (view != null) { view.setPadding(Utilities.dp(6), 0, Utilities.dp(6), 0); } views[0] = (SlideView) findViewById(R.id.login_page1); views[1] = (SlideView) findViewById(R.id.login_page2); views[2] = (SlideView) findViewById(R.id.login_page3); getSupportActionBar().setTitle(views[0].getHeaderName()); if (savedInstanceState != null) { currentViewNum = savedInstanceState.getInt("currentViewNum", 0); } for (int a = 0; a < views.length; a++) { SlideView v = views[a]; if (v != null) { v.delegate = this; v.setVisibility(currentViewNum == a ? View.VISIBLE : View.GONE); } } getWindow().setBackgroundDrawableResource(R.drawable.transparent); getWindow().setFormat(PixelFormat.RGB_565); }
From source file:com.yahala.ui.LoginActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.login_layout); ApplicationLoader.applicationContext = this.getApplicationContext(); mToolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(mToolbar);/*from w w w .j a v a 2s .c om*/ mToolbar.setLogo(R.drawable.ab_icon_fixed2); getSupportActionBar().show(); ImageView view = (ImageView) findViewById(16908332); if (view == null) { view = (ImageView) findViewById(R.id.home); } if (view != null) { view.setPadding(OSUtilities.dp(6), 0, OSUtilities.dp(6), 0); } views[0] = (SlideView) findViewById(R.id.login_page1); views[1] = (SlideView) findViewById(R.id.login_page2); views[2] = (SlideView) findViewById(R.id.login_page3); getSupportActionBar().setTitle(views[0].getHeaderName()); if (savedInstanceState != null) { currentViewNum = savedInstanceState.getInt("currentViewNum", 0); } for (int a = 0; a < views.length; a++) { SlideView v = views[a]; if (v != null) { v.delegate = this; v.setVisibility(currentViewNum == a ? View.VISIBLE : View.GONE); } } getWindow().setBackgroundDrawableResource(R.drawable.transparent); getWindow().setFormat(PixelFormat.RGB_565); }
From source file:eu.geopaparazzi.library.forms.views.GSketchView.java
public void refresh(final Context context) throws Exception { log("Entering refresh...."); if (_value != null && _value.length() > 0) { String[] imageSplit = _value.split(";"); log("Handling images: " + _value); IImagesDbHelper imagesDbHelper = DefaultHelperClasses.getDefaulfImageHelper(); for (String imageId : imageSplit) { log("img: " + imageId); if (imageId.length() == 0) { continue; }//ww w . jav a 2 s . 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 // */ // MarkersUtilities.launchOnImage(context, image); // } // }); 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(";").append(imagePath); } _value = sb.substring(1); log("New img paths: " + _value); } log("Exiting refresh...."); } }
From source file:com.example.admin.viewpageexample.SlidingTab.SlidingTabLayout.java
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);//w w w . j a va 2s. c o m return imageView; }
From source file:com.example.facebook_volley.Albums_photo.SlidingTabAlbum.java
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);//from w w w . ja v a 2 s . c o m return imageView; }
From source file:com.rockerhieu.emojicon.slidingTab.SlidingTabLayout.java
/** * This method was custom added by Ivan, based on the post from * http://stackoverflow.com/questions/28125794/slidingtablayout-with-icons-only/28134763#28134763 * @param context/*from www . j a va2s . co m*/ * @return */ 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); return imageView; }
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 ww w . j a va 2 s . c o 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; }