library projects

Custom control states in library projects

SDK Version: 
M3

This is a tutorial about adding states to custom controls in library projects. So first, how to create and reference library projects: Setting up library projects, Referencing library projects.

Now that the project is setup you can start creating custom controls and states for them. This will all be inside the library project. Firstly you need to create an attributes xml file in values/attrs.xml (the name has to be attrs.xml) and adding the state:

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <resources>    
  3.     <declare-styleable name="customTextViewState";>
  4.         <attr name="state_marked" format="boolean" />
  5.     </declare-styleable>    
  6. </resources>

Syndicate content