Tabnine Logo
android.widget
Code IndexAdd Tabnine to your IDE (free)

How to use android.widget

Best Java code snippets using android.widget (Showing top 20 results out of 44,793)

origin: stackoverflow.com

// text2 has links specified by putting <a> tags in the string
 // resource.  By default these links will appear but not
 // respond to user input.  To make them active, you need to
 // call setMovementMethod() on the TextView object.
 TextView t2 = (TextView) findViewById(R.id.text2);
 t2.setMovementMethod(LinkMovementMethod.getInstance());
origin: stackoverflow.com

 EditText et = (EditText)findViewById(R.id.inbox);
et.setSelection(et.getText().length());
origin: stackoverflow.com

 TextView tv = (TextView)findViewById(R.id.my_text_view);
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams)tv.getLayoutParams();
params.setMargins(0, 0, 10, 0); //substitute parameters for left, top, right, bottom
tv.setLayoutParams(params);
origin: stackoverflow.com

 TextView txt = (TextView) findViewById(R.id.output);
txt.setText("Executed");
origin: stackoverflow.com

 EditText usernameEditText = (EditText) findViewById(R.id.editUsername);
sUsername = usernameEditText.getText().toString();
if (sUsername.matches("")) {
  Toast.makeText(this, "You did not enter a username", Toast.LENGTH_SHORT).show();
  return;
}
origin: libgdx/libgdx

protected FrameLayout.LayoutParams createLayoutParams () {
  FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT,
    android.view.ViewGroup.LayoutParams.MATCH_PARENT);
  layoutParams.gravity = Gravity.CENTER;
  return layoutParams;
}
origin: bumptech/glide

/**
 * Sets the given {@link android.graphics.drawable.Drawable} on the view using {@link
 * android.widget.ImageView#setImageDrawable(android.graphics.drawable.Drawable)}.
 *
 * @param drawable {@inheritDoc}
 */
@Override
public void setDrawable(Drawable drawable) {
 view.setImageDrawable(drawable);
}
origin: bumptech/glide

 /**
  * Sets the {@link android.graphics.Bitmap} on the view using {@link
  * android.widget.ImageView#setImageBitmap(android.graphics.Bitmap)}.
  *
  * @param resource The bitmap to display.
  */
 @Override
 protected void setResource(Bitmap resource) {
  view.setImageBitmap(resource);
 }
}
origin: stackoverflow.com

 EditText editor = new EditText(this); 
editor.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
origin: stackoverflow.com

 RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams)button.getLayoutParams();
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
params.addRule(RelativeLayout.LEFT_OF, R.id.id_to_be_left_of);

button.setLayoutParams(params); //causes layout update
origin: stackoverflow.com

TextView tv = (TextView)findViewById(R.id.image_test);
 LayerDrawable ld = (LayerDrawable)tv.getBackground();
 int topInset = tv.getHeight() / 2 ; //does not work!
 ld.setLayerInset(1, 0, topInset, 0, 0);
 tv.setBackgroundDrawable(ld);
origin: stackoverflow.com

final TextView tv = (TextView)findViewById(R.id.image_test);
   ViewTreeObserver vto = tv.getViewTreeObserver();
   vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
     @Override
     public void onGlobalLayout() {
       LayerDrawable ld = (LayerDrawable)tv.getBackground();
       ld.setLayerInset(1, 0, tv.getHeight() / 2, 0, 0);
     }
   });
origin: stackoverflow.com

 Spinner spinner = (Spinner)findViewById(R.id.spinner);
String text = spinner.getSelectedItem().toString();
origin: stackoverflow.com

 TextView textView = (TextView) findViewById(R.id.myTxtView);
textView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.icon, 0, 0, 0);
origin: libgdx/libgdx

protected FrameLayout.LayoutParams createLayoutParams () {
  FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT,
    android.view.ViewGroup.LayoutParams.MATCH_PARENT);
  layoutParams.gravity = Gravity.CENTER;
  return layoutParams;
}
origin: bumptech/glide

 @Override
 protected void setResource(Drawable resource) {
  this.resource = resource;
  view.setImageDrawable(resource);
 }
}
origin: libgdx/libgdx

protected FrameLayout.LayoutParams createLayoutParams () {
  FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT,
    android.view.ViewGroup.LayoutParams.MATCH_PARENT);
  layoutParams.gravity = Gravity.CENTER;
  return layoutParams;
}
origin: libgdx/libgdx

protected FrameLayout.LayoutParams createLayoutParams () {
  FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT,
    android.view.ViewGroup.LayoutParams.MATCH_PARENT);
  layoutParams.gravity = Gravity.CENTER;
  return layoutParams;
}
origin: libgdx/libgdx

protected FrameLayout.LayoutParams createLayoutParams () {
  FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT,
    android.view.ViewGroup.LayoutParams.MATCH_PARENT);
  layoutParams.gravity = Gravity.CENTER;
  return layoutParams;
}
origin: libgdx/libgdx

protected FrameLayout.LayoutParams createLayoutParams () {
  FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT,
    android.view.ViewGroup.LayoutParams.MATCH_PARENT);
  layoutParams.gravity = Gravity.CENTER;
  return layoutParams;
}
android.widget

Most used classes

  • TextView
  • Toast
  • ImageView
  • Button
  • EditText
  • ListView,
  • FrameLayout,
  • ProgressBar,
  • RelativeLayout,
  • ArrayAdapter,
  • LinearLayout$LayoutParams,
  • FrameLayout$LayoutParams,
  • CheckBox,
  • ImageButton,
  • RelativeLayout$LayoutParams,
  • SeekBar,
  • ScrollView,
  • Spinner,
  • GridView
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now