Creating customs controls in Android


I want to create my own custom controls in Android application and use them in this way: In the XML file:

<MyButton .... />

I would like to define MyButton some where in the resources XML


Create your own subclass of View (e.g., com.ofirbit.MyButton) and then reference it in your layouts (e.g., <com.ofirbit.MyButton android:id="..." />). <a href="https://github.com/commonsguy/cwac-colormixer" rel="nofollow">Here is an Android library project and demonstration sub-project</a> showing an implementation of a custom ColorMixer widget and its use in an application. The details of how to implement one of these can be found in <a href="http://commonsware.com/AdvAndroid" rel="nofollow">some Android books</a>, the <a href="http://developer.android.com/guide/topics/ui/custom-components.html" rel="nofollow">Android documentation</a>, and perhaps elsewhere.


  • Does .jss feature is not supported in Titanium mobile SDK
  • How do I disable the access denied message when trying to do cross scripting into an iframe?
  • Is it OK to write code after [super dealloc]?
  • Change behaviour of Print button in ReportViewer C#
  • Aligning image on right side of title on UIButton with imageEdgeInsets and titleEdgeInsets
  • What is the equivalent of Android permissions in iOS development? [duplicate]
  • jersey/tomcat Description The origin server did not find a current representation for the target res
  • Using same constraints in multiple classes
  • LiveData is abstract android
  • How can I tell a form not to dispose a particular control when it closes?
  • WPF version of .ScaleControl?
  • Bash if statement with multiple conditions
  • Overlapping controls in Windows XP
  • IE7 and TinyMCE with Plone
  • JBoss External Properties Files in Classpath
  • Caching attributes in superclass
  • Sencha Touch 2.0 Controller refs attribute not working?
  • C++ Partial template specialization - design simplification
  • NHibernate Validation Localization with S#arp Architecture
  • When to use `image` and when to use `Matrix` in Emgu CV?
  • What is the “return” in scheme?
  • Bug in WPF DataGrid
  • Which linear programming package should I use for high numbers of constraints and “warm starts” [clo
  • Redux, normalised entities and lodash merge
  • Cannot Parse HTML Data Using Android / JSOUP
  • Comma separated Values
  • Error creating VM instance in Google Compute Engine
  • Hits per day in Google Big Query
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?
  • how does django model after text[] in postgresql [duplicate]
  • Getting Messege Twice Using IMvxMessenger
  • How to get Windows thread pool to call class member function?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?
  • java string with new operator and a literal
  • How to load view controller without button in storyboard?